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

Dispatch Series comparison ops to DatetimeIndex and TimedeltaIndex #19524

Closed
wants to merge 7 commits into from

Conversation

jbrockmendel
Copy link
Member

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.

@codecov
Copy link

codecov bot commented Feb 3, 2018

Codecov Report

Merging #19524 into master will decrease coverage by 0.02%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 89.96% <88.23%> (-0.03%) ⬇️
#single 41.75% <64.7%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/ops.py 96.14% <88.23%> (-0.69%) ⬇️
pandas/plotting/_converter.py 65.22% <0%> (-1.74%) ⬇️
pandas/core/generic.py 95.93% <0%> (-0.01%) ⬇️
pandas/core/indexes/datetimes.py 95.41% <0%> (+0.09%) ⬆️
pandas/core/indexes/base.py 96.68% <0%> (+0.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11de131...a0c14cd. Read the comment docs.

@gfyoung gfyoung added Datetime Datetime data dtype Clean Internals Related to non-user accessible pandas implementation labels Feb 3, 2018
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)
Copy link
Member

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"

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')
Copy link
Member

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.

Copy link
Member Author

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')])
Copy link
Member

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?

Copy link
Member Author

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.

@jbrockmendel
Copy link
Member Author

I can't seem to replicate the test failure. Can anyone else?

ser = pd.Series([pd.Timestamp('2000-01-29 01:59:00'), 'NaT'])
result = ser != ser
assert (result == [False, True]).all()

@jbrockmendel
Copy link
Member Author

I'm having no luck with replicating the error. Closing for now, will revisit when the queue dies down.

@jbrockmendel
Copy link
Member Author

Most recent push was intended for my circleCI account, forgot it would get pushed here. Will revert. No luck SSHijg into circleCI so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Datetime Datetime data dtype Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants