Skip to content

Commit 8eb2a22

Browse files
jbrockmendelmeeseeksmachine
authored andcommitted
Backport PR pandas-dev#43589: PERF: MultiIndex.equals
1 parent 6250341 commit 8eb2a22

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/source/whatsnew/v1.3.4.rst

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ including other versions of pandas.
1515
Fixed regressions
1616
~~~~~~~~~~~~~~~~~
1717
- Fixed regression in :meth:`merge` with integer and ``NaN`` keys failing with ``outer`` merge (:issue:`43550`)
18+
- Fixed performance regression in :meth:`MultiIndex.equals` (:issue:`43549`)
1819
-
1920

2021
.. ---------------------------------------------------------------------------

pandas/core/indexes/multi.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -3517,8 +3517,13 @@ def equals(self, other: object) -> bool:
35173517
if len(self_values) == 0 and len(other_values) == 0:
35183518
continue
35193519

3520-
if not array_equivalent(self_values, other_values):
3521-
return False
3520+
if not isinstance(self_values, np.ndarray):
3521+
# i.e. ExtensionArray
3522+
if not self_values.equals(other_values):
3523+
return False
3524+
else:
3525+
if not array_equivalent(self_values, other_values):
3526+
return False
35223527

35233528
return True
35243529

0 commit comments

Comments
 (0)