Description
Code Sample, a copy-pastable example if possible
>>> pd.Series(['NaT', '2019-01-01', '2019-01-02'], dtype='datetime64[ns]').diff()
0 NaT
1 NaT
2 1 days
dtype: timedelta64[ns]
>>> pd.Series(['NaT', '2019-01-01', '2019-01-02'], dtype='datetime64[ns]').to_frame().diff()
0
0 NaT
1 -88855 days +00:12:43.145224
2 1 days 00:00:00
Problem description
Doing .diff()
on a DataFrame
of datetime64
should yield exactly time deltas in exactly the same way as on the Series
i.e. index (1,0)
in the DataFrame
above should be NaT
, not an overflown timedelta64.
Output of pd.show_versions()
pandas : 1.0.1
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0.post20200210
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None