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

BUG: Timestamp comparisons to dataframe should raise if there are mismatched types #8932

Closed
Tracked by #18824
shoyer opened this issue Nov 29, 2014 · 1 comment · Fixed by #22163
Closed
Tracked by #18824

BUG: Timestamp comparisons to dataframe should raise if there are mismatched types #8932

shoyer opened this issue Nov 29, 2014 · 1 comment · Fixed by #22163
Labels
API Design Bug Compat pandas objects compatability with Numpy or Python functions Datetime Datetime data dtype Timedelta Timedelta data type
Milestone

Comments

@shoyer
Copy link
Member

shoyer commented Nov 29, 2014

Compare (on Python 2.7):

In [7]: pd.Timestamp('2000-01-01') > pd.Series(range(5))
TypeError: Cannot compare type 'Timestamp' with type 'int'

In [8]: pd.Timestamp('2000-01-01') > pd.DataFrame({'x': range(5)})
Out[8]:
      x
0  True
1  True
2  True
3  True
4  True

Probably will fix this in the process of getting #8916 to pass, but I wanted to raise this as a separate issue in case this is intentional. Pretty sure it's not, but there was a test-case specifically introduced that relies on this behavior (see PR #4983).

@jreback
Copy link
Contributor

jreback commented Nov 29, 2014

this is related to this: #8554

Its actually a bit non-trivial as the scalar/Index/Series machinery is well tested/consistent. However, the DataFrame machinery for the same takes a different path and thus needs to be changed (This is the whole usage of Timeops in core/ops.py.

@jreback jreback added API Design Bug Compat pandas objects compatability with Numpy or Python functions Timedelta Timedelta data type Datetime Datetime data dtype labels Nov 29, 2014
@jreback jreback added this to the 0.16.0 milestone Nov 29, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jreback jreback modified the milestones: Contributions Welcome, 0.24.0 Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Compat pandas objects compatability with Numpy or Python functions Datetime Datetime data dtype Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants