{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/14940","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14940/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14940/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14940/events","html_url":"https://github.com/pandas-dev/pandas/issues/14940","id":196903457,"number":14940,"title":"pandas.Series.dt.round inconsistent behaviour on NAT's with different arguments?","user":{"login":"rizac","id":6418666,"avatar_url":"https://avatars.githubusercontent.com/u/6418666?v=3","gravatar_id":"","url":"https://api.github.com/users/rizac","html_url":"https://github.com/rizac","followers_url":"https://api.github.com/users/rizac/followers","following_url":"https://api.github.com/users/rizac/following{/other_user}","gists_url":"https://api.github.com/users/rizac/gists{/gist_id}","starred_url":"https://api.github.com/users/rizac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rizac/subscriptions","organizations_url":"https://api.github.com/users/rizac/orgs","repos_url":"https://api.github.com/users/rizac/repos","events_url":"https://api.github.com/users/rizac/events{/privacy}","received_events_url":"https://api.github.com/users/rizac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-21T10:57:08Z","updated_at":"2016-12-21T11:17:30Z","closed_at":null,"body":"#### Code Sample, a copy-pastable example if possible\r\n\r\n```python\r\n# Your code here\r\nimport pandas as pd\r\nfrom datetime import datetime\r\nd=pd.DataFrame(data=[[datetime(2010,1,1,23,14,12,599), 2], [None, 4]], columns=['dtime', 'int'])\r\nprint d['dtime'].dt.round('s')\r\nprint d['dtime'].dt.round('5s')\r\nprint d['dtime'].dt.round('min')\r\n```\r\n#### Problem description\r\n\r\nThis is the output I get:\r\n\r\n```python\r\n0   2010-01-01 23:14:12\r\n1                   NaT\r\nName: dtime, dtype: datetime64[ns]\r\n\r\n0   2010-01-01 23:14:10.000000000\r\n1   2262-04-10 00:12:44.999999488\r\nName: dtime, dtype: datetime64[ns]\r\n\r\n0   2010-01-01 23:14:00\r\n1   2262-04-10 00:13:00\r\nName: dtime, dtype: datetime64[ns]\r\n```\r\n\r\nIn 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 googed and browsed the docs shouldn't be that hidden), this seems to be a bug\r\n\r\n#### Expected Output\r\n0   2010-01-01 23:14:12\r\n1                   NaT\r\nName: dtime, dtype: datetime64[ns]\r\n\r\n0   2010-01-01 23:14:10.000000000\r\n1                   NaT\r\nName: dtime, dtype: datetime64[ns]\r\n\r\n0   2010-01-01 23:14:00\r\n1                   NaT\r\nName: dtime, dtype: datetime64[ns]\r\n\r\n#### Output of ``pd.show_versions()``\r\n\r\n<details>\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 2.7.11.final.0\r\npython-bits: 64\r\nOS: Darwin\r\nOS-release: 15.6.0\r\nmachine: x86_64\r\nprocessor: i386\r\nbyteorder: little\r\nLC_ALL: en_US.UTF-8\r\nLANG: en_US.UTF-8\r\n\r\npandas: 0.18.1\r\nnose: None\r\npip: 9.0.1\r\nsetuptools: 24.0.2\r\nCython: None\r\nnumpy: 1.11.1\r\nscipy: 0.17.1\r\nstatsmodels: None\r\nxarray: None\r\nIPython: None\r\nsphinx: None\r\npatsy: None\r\ndateutil: 2.5.3\r\npytz: 2016.4\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nmatplotlib: 1.5.1\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: 3.6.0\r\nbs4: None\r\nhtml5lib: None\r\nhttplib2: None\r\napiclient: None\r\nsqlalchemy: 1.0.13\r\npymysql: None\r\npsycopg2: 2.6.2 (dt dec pq3 ext lo64)\r\njinja2: 2.8\r\nboto: None\r\npandas_datareader: None\r\n</details>\r\n"},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/268498340","html_url":"https://github.com/pandas-dev/pandas/issues/14940#issuecomment-268498340","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14940","id":268498340,"user":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T11:17:30Z","updated_at":"2016-12-21T11:17:30Z","body":"yep, this looks buggy. need to mask the NaT's before and replace after, use ``self.hasnan``\r\n\r\nFurther looks like ``Timestamp`` doesn't implement these (should return a NaT), so need to modify ``NaTType``.\r\n\r\n```\r\nIn [6]: d['dtime'][1].round('s')\r\nAttributeError: 'NaTType' object has no attribute 'round'\r\n\r\nIn [7]: d['dtime'][1].round('5s')\r\nAttributeError: 'NaTType' object has no attribute 'round'\r\n```\r\n\r\nprob also buggy for ``.floor`` and ``.ceil``\r\n\r\nPR's welcome!"}}
{"actor":{"display_login":"jreback"}}