In pandas 0.17.1, a TypeError is returned when trying to subtract a timezone-aware timestamp from a NaT timestamp:
In [1]: import pandas as pd In [2]: pd.Timestamp(None, tz='utc') - pd.Timestamp('now', tz='utc') Traceback (most recent call last): File "<ipython-input-2-5e0738cec5fa>", line 1, in <module> pd.Timestamp(None, tz='utc') - pd.Timestamp('now', tz='utc') File "pandas\tslib.pyx", line 1099, in pandas.tslib._NaT.__sub__ (pandas\tslib.c:21618) File "pandas\tslib.pyx", line 1026, in pandas.tslib._Timestamp.__sub__ (pandas\tslib.c:20036) TypeError: Timestamp subtraction must have the same timezones or no timezones
Subtracting a timezone unaware timestamp from a NaT timestamp is no problem. Also subtracting a NaT from a timezone aware timestamp works:
In [3]: pd.Timestamp(None) - pd.Timestamp('now') Out[3]: NaT In [4]: pd.Timestamp('now', tz='utc') - pd.Timestamp(None, tz='utc') Out[4]: NaT In [5]: pd.Timestamp('now', tz='utc') - pd.Timestamp(None) Out[5]: NaT
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4