[Numpy-discussion] Default unit for datetime/timedelta

Dave Hirschfeld dave.hirschfeld@gmail....
Thu Jun 9 04:17:38 CDT 2011


Mark Wiebe <mwwiebe <at> gmail.com> writes:

> 
> Here are some current behaviors that are inconsistent with the microsecond
default, but consistent with the "generic time unit" idea:
> 
> >>> np.timedelta64(10, 's') + 10
> numpy.timedelta64(20,'s')
> 
> 

That is what I would expect (and hope) would happen. IMO an integer should be
cast to the dtype ([s]) of the datetime/timedelta.

> 
> >>> np.array(['2011-03-12T13', '2012'], dtype='M8')
> array(['2011-03-12T13:00:00.000000-0600', '2011-12-31T18:00:00.000000-0600'],
dtype='datetime64[us]')
> 

I would expect the second value of the array to be midnight at the end of the
year. I'm not sure what is actually happening in the above example. What happens
if I email that code to someone in New Zealand would they get a different array??

-Dave






More information about the NumPy-Discussion mailing list