Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp comparisons to Series should work on either side of the comparison operator #4982

Closed
cpcloud opened this issue Sep 25, 2013 · 2 comments · Fixed by #4983
Closed
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@cpcloud
Copy link
Member

cpcloud commented Sep 25, 2013

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
@jreback
Copy link
Contributor

jreback commented Sep 25, 2013

related to #3428 which was impossible to fix, but this IS fixable

@cpcloud
Copy link
Member Author

cpcloud commented Sep 25, 2013

pr coming shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants