For some reason that I can't find in the Pandas summary for 0.17.1, comparing the datetime series with an int (Unix epoch) value no longer works. Can someone explain this or point me to the right section in the change log?
Work in 0.16.2
>>> import pandas as pd
>>> import datetime
>>> d = pd.Series([datetime.datetime(2016, 1, 1), datetime.datetime(2016, 1, 1)])
>>> d
0 2016-01-01
1 2016-01-01
dtype: datetime64[ns]
>>> d.dtype
dtype('<M8[ns]')
>>> d > 10
0 True
1 True
dtype: bool
Error in 0.17.1
>>> import pandas as pd
>>> import datetime
>>> d = pd.Series([datetime.datetime(2016, 1, 1), datetime.datetime(2016, 1, 1)])
>>> d > 10
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sven/tmp/pandastest/pandas-0.17.1/lib/python2.7/site-packages/pandas/core/ops.py", line 726, in wrapper
res = na_op(values, other)
File "/Users/sven/tmp/pandastest/pandas-0.17.1/lib/python2.7/site-packages/pandas/core/ops.py", line 657, in na_op
raise TypeError("invalid type comparison")
TypeError: invalid type comparison
source
share