[Numpy-discussion] newbie: attempt at data frame

Vincent Nijs v-nijs at kellogg.northwestern.edu
Thu Dec 28 17:39:12 CST 2006


Based on Eike's input the dbase class can now also load and dump (simple)
csv and pickle files. See the tests at the bottom of the file and the
doc-strings.

If there is an easy way to read array data + variable names using the csv
module it would be great if that could be added to cookbook/InputOutput. I
couldn't figure out how to do it.

Eike:
I think I can figure out how to add a plot method. However, if you have some
more suggestions on how to implement the getAtTime, extract, and set methods
you mentioned that would be great.

Vincent


On 12/28/06 1:40 PM, "Vincent Nijs" <v-nijs at kellogg.northwestern.edu> wrote:

> Thanks for the input Eike.
> 
> I will add load and store methods to Pickle/UnPickle the object. I have got
> to get the data into the class first however from an ascii file (txt or
> csv).
> 
> I'd like to read the data and variable names directly from a single csv
> file. I tried this through the python csv module but it would read all data
> as strings and I couldn't figure out how to easily separate the variable
> names and the data. I you have any suggestion on how I might do this please
> let me know.
> 
> Unfortunately I don't know what a 'set' method is or would do :) Could you
> point to an example perhaps.
> 
> I like your ideas for extending the class. I'll look into that when I get
> the basic class working.
> 
> Best,
> 
> Vincent
> 
> 
> On 12/28/06 12:54 PM, "Eike Welk" <eike.welk at gmx.net> wrote:
> 
>> If your main concern is to store scientific data on disk you might
>> try: 
>> http://www.pytables.org/moin
>> 
>> However, it uses numarray internally and a C library, which you have
>> to build from source. (You use a Mac right?)
>> 
>> 
>> Concerning your code:
>> - Your two file solution seems impractical to me. I think you should
>> just pickle your whole dbase object.
>> - Maybe you should write 'load' and 'store' methods that create the
>> temporary file, Pickler and Unpickler objects.
>> -The __init__ method should then construct the object from a list of
>> variable names and an array.
>> -Offcourse you need a set method.
>> 
>> more ideas:
>> - A special variable name 'time'. Then you can implement a
>> getAtTime( varNameList, timePoint) method with interpolation.
>> - A 'plot' method that works like matplotlib's plot function.
>> - An extract(varNameList) method, that returns a new dbase object with
>> only the selected variables.
>> - A companion class that can hold several time series at once to
>> compare different experiments.
>> 
>> Finally, post the code to the mailing list. At least I would like to
>> use such a class :-).
>> 
>> Yours
>> Eike.
>> 
>> _______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion at scipy.org
>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>> 

-- 
Vincent R. Nijs
Assistant Professor of Marketing
Kellogg School of Management, Northwestern University
2001 Sheridan Road, Evanston, IL 60208-2001
Phone: +1-847-491-4574 Fax: +1-847-491-2498
E-mail: v-nijs at kellogg.northwestern.edu
Skype: vincentnijs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbase.py
Type: application/octet-stream
Size: 2800 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061228/66557583/attachment.obj 


More information about the Numpy-discussion mailing list