Skip to content

Commit 0a35903

Browse files
authored
PERF: MultiIndex.equals (#43589)
1 parent eb643d7 commit 0a35903

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
@@ -3544,8 +3544,13 @@ def equals(self, other: object) -> bool:
35443544
if len(self_values) == 0 and len(other_values) == 0:
35453545
continue
35463546

3547-
if not array_equivalent(self_values, other_values):
3548-
return False
3547+
if not isinstance(self_values, np.ndarray):
3548+
# i.e. ExtensionArray
3549+
if not self_values.equals(other_values):
3550+
return False
3551+
else:
3552+
if not array_equivalent(self_values, other_values):
3553+
return False
35493554

35503555
return True
35513556

0 commit comments

Comments
 (0)