Skip to content

BUG: MultiIndex.equals returning incorrectly True when Indexes contains NaN #38511

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

Merged
merged 3 commits into from
Dec 17, 2020

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 15, 2020

Depending on the expected behavior of align, this may have hidden an additional bug in align in the referenced issue.

@@ -3454,12 +3454,14 @@ def equals(self, other: object) -> bool:

for i in range(self.nlevels):
self_codes = self.codes[i]
other_codes = other.codes[i]
if not np.array_equal(self_codes == -1, other_codes == -1):
Copy link
Contributor

Choose a reason for hiding this comment

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

prob could define

self_mask = self_codes ==  -1
other_mask = other_codes == -1

and use here and L3460 and L3465

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, is probably faster.

Thx

@jreback jreback added this to the 1.3 milestone Dec 17, 2020
@jreback jreback merged commit 0556613 into pandas-dev:master Dec 17, 2020
@jreback
Copy link
Contributor

jreback commented Dec 17, 2020

thanks @phofl

@phofl phofl deleted the 38439 branch December 17, 2020 16:11
luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants