Timestamp comparisons to Series should work on either side of the comparison operator · Issue #4982 · pandas-dev/pandas (original) (raw)
In [2]: df = DataFrame({'dates': date_range('20010101', periods=10)})
In [3]: Timestamp('20010109') < df.dates
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-713f2b228d0e> in <module>()
----> 1 Timestamp('20010109') < df.dates
/home/phillip/Documents/code/py/pandas/pandas/tslib.so in pandas.tslib._Timestamp.__richcmp__ (pandas/tslib.c:9555)()
TypeError: Cannot compare Timestamp with 'Series'
but when a Series
is on the left hand side, things go swimmingly:
In [4]: df.dates < Timestamp('20010109')
Out[4]:
0 True
1 True
2 True
3 True
4 True
5 True
6 True
7 True
8 False
9 False
Name: dates, dtype: bool