file object as container class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew Wilson

    file object as container class

    I have a bunch of classes that track data for time series. The classes are
    really just glorified dicts where the key is a date object, and the value is the
    value as of that date.

    I want a way to store a bunch of these tseries objects into a file object. I
    want to be able to open the file object, iterate through all timeseries, then
    create some new tseries, and add them to the file object. I also want to be
    able to delete tseries from the file object.

    Can anyone give me any pointers on how to write a file object like this?

  • Michael Peuser

    #2
    Re: file object as container class

    "Matthew Wilson" <mwilson@sarcas tic-horse.com>
    [color=blue]
    > I have a bunch of classes that track data for time series. The classes[/color]
    are[color=blue]
    > really just glorified dicts where the key is a date object, and the value[/color]
    is the[color=blue]
    > value as of that date.
    >
    > I want a way to store a bunch of these tseries objects into a file object.[/color]
    I[color=blue]
    > want to be able to open the file object, iterate through all timeseries,[/color]
    then[color=blue]
    > create some new tseries, and add them to the file object. I also want to[/color]
    be[color=blue]
    > able to delete tseries from the file object.
    >
    > Can anyone give me any pointers on how to write a file object like this?[/color]

    It depends on the size of it. If you have, say, less than 30 MB (c)pickle
    will do fine and you have absolute control about everything. The new cpicke
    is very fast, however the disadvantage is, that you completely read and
    rewrite the file.

    If your files are larger than, say, 300 MB, you should in fact use some
    database concept. There is a twighlight zone between 30 and 300 MB ;-)

    Kindly
    MichaelP[color=blue]
    >[/color]


    Comment

    Working...