-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Dispatch Series comparison ops to DatetimeIndex and TimedeltaIndex #19524
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19524 +/- ##
==========================================
- Coverage 91.6% 91.58% -0.03%
==========================================
Files 150 150
Lines 48867 48866 -1
==========================================
- Hits 44767 44755 -12
- Misses 4100 4111 +11
Continue to review full report at Codecov.
|
pandas/core/ops.py
Outdated
if not self._indexed_same(other): | ||
msg = 'Can only compare identically-labeled Series objects' | ||
raise ValueError(msg) | ||
# By this point we know that self._indexed_same(other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comma between "point" and "we"
pandas/core/ops.py
Outdated
if isinstance(other, ABCDataFrame): # pragma: no cover | ||
# Defer to DataFrame implementation; fail early | ||
return NotImplemented | ||
|
||
elif isinstance(other, ABCSeries) and not self._indexed_same(other): | ||
raise ValueError('Can only compare identically-labeled Series ' | ||
'objects') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I prefer not to "orphan" words on their own line. Move the "Series" part of your sentence there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change. Ditto comma above.
@@ -349,7 +349,7 @@ def test_loc_datetime_length_one(self): | |||
|
|||
@pytest.mark.parametrize('datetimelike', [ | |||
Timestamp('20130101'), datetime(2013, 1, 1), | |||
date(2013, 1, 1), np.datetime64('2013-01-01T00:00', 'ns')]) | |||
np.datetime64('2013-01-01T00:00', 'ns')]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you have to change the parametrization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b/c ATM Series[datetime64].__cmp__(date)
treats the date
as a datetime
, i.e. allows the comparison. But DatetimeIndex
does not -- following convention set by Timestamp
(and datetime
itself). The DatetimeIndex
behavior is canonical.
I can't seem to replicate the test failure. Can anyone else?
|
I'm having no luck with replicating the error. Closing for now, will revisit when the queue dies down. |
Most recent push was intended for my circleCI account, forgot it would get pushed here. Will revert. No luck SSHijg into circleCI so far. |
a1a5c72
to
a0c14cd
Compare
Another couple steps towards unifying the implementations.
We will be able to simplify _comp_method_SERIES a lot if/when the Categorical vs CategoricalIndex inconsistencies are sorted out #19513.