You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that whatever the unit of time used in timedelta64 (day, week, hour, year), when operating with a datetime64[ns] value, the timedelta integer is operated as nanosecond. Hence, if we intend to add or subtract one week (or day, or hour, or year), only one nanosecond is subtracted instead.
In [7]: importnumpyasnpIn [8]: importpandasaspdIn [9]: frompandasimportSeriesIn [10]: a=np.timedelta64(1, 'W')
In [11]: aOut[11]: numpy.timedelta64(1,'W')
In [12]: b=Series(pd.to_datetime('1/1/2010'))
In [13]: bOut[13]:
02010-01-0100:00:00dtype: datetime64[ns]
In [14]: b-aOut[14]:
02009-12-3123:59:59.999999999dtype: datetime64[ns]
In [15]: pd.__version__, np.__version__Out[15]: ('0.12.0', '1.7.1')
The text was updated successfully, but these errors were encountered:
It seems that whatever the unit of time used in timedelta64 (day, week, hour, year), when operating with a datetime64[ns] value, the timedelta integer is operated as nanosecond. Hence, if we intend to add or subtract one week (or day, or hour, or year), only one nanosecond is subtracted instead.
The text was updated successfully, but these errors were encountered: