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

Christopher Barker Chris.Barker@noaa....
Mon Jul 28 13:31:07 CDT 2008


Hi,

Sorry for the very long delay in commenting on this. In short, it looks 
great, and thanks for your efforts.

A couple small comments:

 >  In [11]: t[0] = datetime.datetime.now()  # setter in action

 >  In [12]: t[0]
 >  Out[12]: '2008-07-16T13:39:25.315'   # representation in ISO 8601
format

I like that, but what about:

>  In [8]: t1 = numpy.zeros(5, dtype="datetime64[s]")
>  In [9]: t2 = numpy.ones(5, dtype="datetime64[s]")
> 
>   In [10]: t = t2 - t1
> 
>   In [11]: t[0] = 24  # setter in action (setting to 24 seconds)

Is there a way to set in any other units? (hours, days, etc.)

>   In [12]: t[0]
>   Out[12]: 24       # representation as an int64

why not a "pretty" representation of timedelta64 too? I'd like that 
better (at least for __str__, perhaps __repr__ should be the raw numbers.

how will operations between different types work?

 > t1 = numpy.ones(5, dtype="timedelta64[s]")
 > t2 = numpy.ones(5, dtype="timedelta64[ms]")

t1 + t2

 >> ??????

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the Numpy-discussion mailing list