Skip to content

Commit b2b81d8

Browse files
authored
CLN: Remove duplicate from MultiIndex.equals (#37961)
1 parent fc92c6e commit b2b81d8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pandas/core/indexes/multi.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -3312,21 +3312,19 @@ def equals(self, other: object) -> bool:
33123312
if not isinstance(other, Index):
33133313
return False
33143314

3315+
if len(self) != len(other):
3316+
return False
3317+
33153318
if not isinstance(other, MultiIndex):
33163319
# d-level MultiIndex can equal d-tuple Index
33173320
if not is_object_dtype(other.dtype):
33183321
# other cannot contain tuples, so cannot match self
33193322
return False
3320-
elif len(self) != len(other):
3321-
return False
33223323
return array_equivalent(self._values, other._values)
33233324

33243325
if self.nlevels != other.nlevels:
33253326
return False
33263327

3327-
if len(self) != len(other):
3328-
return False
3329-
33303328
for i in range(self.nlevels):
33313329
self_codes = self.codes[i]
33323330
self_codes = self_codes[self_codes != -1]

0 commit comments

Comments
 (0)