Skip to content

Backport PR #43589 on branch 1.3.x (PERF: MultiIndex.equals) #43610

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.3.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ including other versions of pandas.
Fixed regressions
~~~~~~~~~~~~~~~~~
- Fixed regression in :meth:`merge` with integer and ``NaN`` keys failing with ``outer`` merge (:issue:`43550`)
- Fixed performance regression in :meth:`MultiIndex.equals` (:issue:`43549`)
-

.. ---------------------------------------------------------------------------
Expand Down
9 changes: 7 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3517,8 +3517,13 @@ def equals(self, other: object) -> bool:
if len(self_values) == 0 and len(other_values) == 0:
continue

if not array_equivalent(self_values, other_values):
return False
if not isinstance(self_values, np.ndarray):
# i.e. ExtensionArray
if not self_values.equals(other_values):
return False
else:
if not array_equivalent(self_values, other_values):
return False

return True

Expand Down