Description
Code Sample
# Your code here
import pandas as pd
from datetime import datetime
d=pd.DataFrame(data=[[datetime(2010,1,1,23,14,12,599), 2], [None, 4]], columns=['dtime', 'int'])
print d['dtime'].dt.round('s')
print d['dtime'].dt.round('5s')
print d['dtime'].dt.round('min')
Problem description
This is the output I get:
0 2010-01-01 23:14:12
1 NaT
Name: dtime, dtype: datetime64[ns]
0 2010-01-01 23:14:10.000000000
1 2262-04-10 00:12:44.999999488
Name: dtime, dtype: datetime64[ns]
0 2010-01-01 23:14:00
1 2262-04-10 00:13:00
Name: dtime, dtype: datetime64[ns]
In the first case (freq argument 's') NaT are preserved (I would say, as I expect). However, in the second and third case, NaT's are converted to some apparently weird date time. If I don't miss some particular information (which in case after I googled and browsed the docs shouldn't be that hidden), this seems to be a bug
Expected Output
0 2010-01-01 23:14:12
1 NaT
Name: dtime, dtype: datetime64[ns]
0 2010-01-01 23:14:10.000000000
1 NaT
Name: dtime, dtype: datetime64[ns]
0 2010-01-01 23:14:00
1 NaT
Name: dtime, dtype: datetime64[ns]
Output of pd.show_versions()
pandas: 0.18.1
nose: None
pip: 9.0.1
setuptools: 24.0.2
Cython: None
numpy: 1.11.1
scipy: 0.17.1
statsmodels: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: 3.6.0
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None