[Numpy-discussion] RFC: A proposal for implementing some date/time types in NumPy

Francesc Alted falted@pytables....
Mon Jul 14 05:58:56 CDT 2008


A Friday 11 July 2008, Christopher Barker escrigué:
> >>>> print example
> >
> > [Jul-2008 Aug-2008 Sep-2008 Oct-2008 Nov-2008 Dec-2008]
>
> I like this -- seeing the integers for the times makes me wonder what
> that point is -- we've all been using numbers for time for years
> already -- what would a datetime array give us other than
> auto-conversion from datetime objects, if it doesn't include nicer
> display, timedelta, etc.

I see your point and I think that it would be a great addition to the 
date/time types to support additional resolution meta-information in 
order to offer the most proper string representation.  And I'm starting 
to see the merit of a timedelta type too.

> > Now that I think about this, wouldn't be better if, after the
> > eventual introduction of the new datetime types in NumPy, the
> > matplotlib would use any of these three and throw away their
> > current datetime class?
>
> yes, that would be better, but what to do during the transition?

Well, John Hunter has already agreed to adapt mpl to the NumPy date/time 
as soon as they are in, so I suppose they will have to decide the path 
for the transition.

> I'm also imaging some extra utility functions/method that would be
> nice:
>
> aDateTimeArray.hours(dtype=float)
>
> to convert to hours (and days, and seconds, etc). And maybe some that
> would create a DateTimeArray from various time units.
>
> I often have to read/write data files that have time in various units
> like that -- it would be nice to use array operations to work with
> them.

I think that a datetime type with a resolution property can help here.
I hope to post soon the new proposal about this.

Cheers,

-- 
Francesc Alted


More information about the Numpy-discussion mailing list