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: Index._id #37321

Merged
merged 2 commits into from
Oct 22, 2020
Merged

BUG: Index._id #37321

merged 2 commits into from
Oct 22, 2020

Conversation

topper-123
Copy link
Contributor

Fixes #37213.

@jreback jreback added the Index Related to the Index class or subclasses label Oct 22, 2020
@jreback jreback added this to the 1.2 milestone Oct 22, 2020
if self is other:
return True
else:
return self._id is not None and self._id is getattr(other, "_id", Ellipsis)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm how is this equal to Ellipsis?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used Ellipsis instead of None, because self._id might be None, triggering a false Positive.

It's probably still too obscure, so I've made a more explicit version in a new commit.

@jreback jreback merged commit 695e568 into pandas-dev:master Oct 22, 2020
@jreback
Copy link
Contributor

jreback commented Oct 22, 2020

thanks @topper-123

@spencerkclark
Copy link
Contributor

Indeed thanks @topper-123!

@topper-123 topper-123 deleted the index_id_optional branch October 23, 2020 07:09
@jorisvandenbossche
Copy link
Member

This might have resulted in a slowdown, see https://pandas.pydata.org/speed/pandas/#multiindex_object.Equals.time_equals_non_object_index?commits=f162aacc-4f5e0e06&Cython=0.29.21&python=3.8 (this commits looks most related in the relevant commit range). Now, the benchmark is only about small numbers though, so it is still fast. It's only a microbenchmark.

From a quick profile, it might be that in this case the com.any_is_none is giving a lot of overhead compared to the overall speed of the method.

JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Oct 26, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QST: How to handle Index._id in an Index subclass?
4 participants