ENH: support diff with datetime64[ns] on series/frame · Issue #3100 · pandas-dev/pandas (original) (raw)

see #2984

workaround right now is

In [4]: s = pd.Series(pd.date_range('20130102',periods=5))

In [5]: s
Out[5]: 
0   2013-01-02 00:00:00
1   2013-01-03 00:00:00
2   2013-01-04 00:00:00
3   2013-01-05 00:00:00
4   2013-01-06 00:00:00
dtype: datetime64[ns]

This is the workaround right now
In [6]: s-s.shift(1)
Out[6]: 
0                NaT
1   1 days, 00:00:00
2   1 days, 00:00:00
3   1 days, 00:00:00
4   1 days, 00:00:00
dtype: timedelta64[ns]

Bad.....

In [7]: s.diff()
Out[7]: 
0             NaN
1    8.640000e+13
2    8.640000e+13
3    8.640000e+13
4    8.640000e+13
dtype: float64