Hi Anthony, Thanks for your suggestions. I'll try number (1) and see how it goes. If, however, I still need number (2) and have the time to do a decent work I let you know. Indeed it would be nice to have the numpy.datetime64 with its arithmetic capabilities supported in pytables.
Thanks, -Fernando On Thu, Nov 3, 2011 at 4:20 PM, Anthony Scopatz <scop...@gmail.com> wrote: > Hello Fernando, > I personally have always found the 64-bit time stamps to be much more useful > (and much less ambiguous) than Python datetime objects. > However, if against my better judgement, you decide to store datetimes, you > effectively have three options (in preferred order): > > Create a numpy dtype or PyTables description that matches the structure of > datetime to your desired precision and save them in a Table. If you want to > save timezone information as well, I might add an extra length-3 string > column and save the str representation of the tzinfo field ('UTC', 'KST', > 'EDT'). > Look into the new numpy native datetime type. I am not sure how they are > storing this under the covers; it might be as time stamps plus some > meta-data (which would be easy for use to store). Then it would be nice for > PyTables to have an appropriate Col subclass to go along with this. > Store an array of pickled datatime objects (and possibly index it). This is > ill-advised as it will likely be slow. > > I would go with (1). Number (2) should probably be done eventually (and it > would be great if you did some leg work and had a pull request ~_~). > Be Well > Anthony > On Thu, Nov 3, 2011 at 12:26 AM, Fernando Paolo <fspa...@gmail.com> wrote: >> >> Hi Ben, >> >> Thanks for the reply. Actually that's the way my measurements come (a >> single number representing seconds since a reference epoch). What I >> need is to fractionate this number into the respective time elements >> (year, month, day, hour, secs, micro secs) and operate with them. So I >> would appreciate any suggestion on how to properly store (or >> represent) these on a very large table in order to be able to perform >> queries (without inconvenient transformations on the fly). >> >> Thank you - Fernando >> >> >> On Wed, Nov 2, 2011 at 9:55 PM, Ben Elliston <b...@air.net.au> wrote: >> > Hi Fernando >> > >> > I don't know about datetime, per se, but you can also convert your >> > times/dates into time since Unix epoch and store that as a single >> > 64-bit integer. >> > >> > Cheers, Ben >> > >> > >> > ------------------------------------------------------------------------------ >> > RSA(R) Conference 2012 >> > Save $700 by Nov 18 >> > Register now >> > http://p.sf.net/sfu/rsa-sfdev2dev1 >> > _______________________________________________ >> > Pytables-users mailing list >> > Pytables-users@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/pytables-users >> > >> >> >> >> -- >> Fernando Paolo >> Institute of Geophysics & Planetary Physics >> Scripps Institution of Oceanography >> University of California, San Diego >> 9500 Gilman Drive >> La Jolla, CA 92093-0225 >> >> web: fspaolo.net >> >> >> ------------------------------------------------------------------------------ >> RSA(R) Conference 2012 >> Save $700 by Nov 18 >> Register now >> http://p.sf.net/sfu/rsa-sfdev2dev1 >> _______________________________________________ >> Pytables-users mailing list >> Pytables-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/pytables-users > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Pytables-users mailing list > Pytables-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pytables-users > > -- Fernando Paolo Institute of Geophysics & Planetary Physics Scripps Institution of Oceanography University of California, San Diego 9500 Gilman Drive La Jolla, CA 92093-0225 web: fspaolo.net ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users