Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-09 Thread Mark Wiebe
On Thu, Jun 9, 2011 at 4:17 AM, Dave Hirschfeld wrote: > Mark Wiebe 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

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-09 Thread Mark Wiebe
On Thu, Jun 9, 2011 at 1:38 AM, Pierre GM wrote: > > On Jun 9, 2011, at 2:22 AM, Mark Wiebe wrote: > > > > >>> np.array(['2011-03-12T13', '2012'], dtype='M8') > > > > array(['2011-03-12T13:00:00.00-0600', > '2011-12-31T18:00:00.00-0600'], dtype='datetime64[us]') > > > > > > Why is the sec

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-09 Thread Dave Hirschfeld
Mark Wiebe 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. IM

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-08 Thread Pierre GM
On Jun 9, 2011, at 2:22 AM, Mark Wiebe wrote: > > > >>> np.array(['2011-03-12T13', '2012'], dtype='M8') > > > array(['2011-03-12T13:00:00.00-0600', > > > '2011-12-31T18:00:00.00-0600'], dtype='datetime64[us]') > > > > Why is the second one not '2012-01-01T00:00:00-0600' ? > > > > This is

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-08 Thread Mark Wiebe
On Wed, Jun 8, 2011 at 6:31 PM, Pierre GM wrote: > > On Jun 9, 2011, at 1:10 AM, Mark Wiebe wrote: > > > > > >>> np.timedelta64(10, 's') + 10 > > > numpy.timedelta64(20,'s') > > > > Here, the unit is defined: 's' > > > > For the first operand, the inconsistency is with the second. Here's the > r

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-08 Thread Pierre GM
On Jun 9, 2011, at 1:10 AM, Mark Wiebe wrote: > > > >>> np.timedelta64(10, 's') + 10 > > numpy.timedelta64(20,'s') > > Here, the unit is defined: 's' > > For the first operand, the inconsistency is with the second. Here's the > reasoning I didn't spell out: > We're adding a timedelta + int, s

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-08 Thread Mark Wiebe
On Wed, Jun 8, 2011 at 5:48 PM, Pierre GM wrote: > > On Jun 8, 2011, at 11:05 PM, Mark Wiebe wrote: > > > The NEP and current implementation of the datetime specifies microseconds > as the default unit when constructing and converting to datetimes and > timedeltas. > > AFAIU, the default is [us]

Re: [Numpy-discussion] Default unit for datetime/timedelta

2011-06-08 Thread Pierre GM
On Jun 8, 2011, at 11:05 PM, Mark Wiebe wrote: > The NEP and current implementation of the datetime specifies microseconds as > the default unit when constructing and converting to datetimes and timedeltas. AFAIU, the default is [us] when otherwise unspecified. > Here are some current behavior

[Numpy-discussion] Default unit for datetime/timedelta

2011-06-08 Thread Mark Wiebe
The NEP and current implementation of the datetime specifies microseconds as the default unit when constructing and converting to datetimes and timedeltas. Having the np.arange function work in a general, intuitive way for a wide variety of datetime/timedelta/integer inputs is turning out to be ver