Re: [Numpy-discussion] Changing the datetime operation unit rules

2011-06-07 Thread Mark Wiebe
On Tue, Jun 7, 2011 at 4:47 PM, Dave Hirschfeld wrote: > Mark Wiebe gmail.com> writes: > > > > > >>> a = np.datetime64('today') > > > > >>> a - a.astype('M8[Y]') > > > > numpy.timedelta64(157,'D') > > > > vs > > > > > > >>> a = np.datetime64('today') > > >>> a - a.astype('M8[Y]') > > Traceback (m

Re: [Numpy-discussion] Changing the datetime operation unit rules

2011-06-07 Thread Dave Hirschfeld
Mark Wiebe gmail.com> writes: > > >>> a = np.datetime64('today') > > >>> a - a.astype('M8[Y]') > > numpy.timedelta64(157,'D') > > vs > > > >>> a = np.datetime64('today') > >>> a - a.astype('M8[Y]') > Traceback (most recent call last): > File "", line 1, in > TypeError: ufunc subtract can

[Numpy-discussion] Changing the datetime operation unit rules

2011-06-07 Thread Mark Wiebe
The NEP for datetime specifies a set of rules for how units should behave when combined with + or -. After playing around with the implementation a bit, I think the rules need to be changed. First, subtracting two datetime64's should produce the more precise unit. This allows things like the follow