File tree 2 files changed +7
-22
lines changed
2 files changed +7
-22
lines changed Original file line number Diff line number Diff line change @@ -2216,16 +2216,14 @@ def equals(self, other):
2216
2216
if self .is_ (other ):
2217
2217
return True
2218
2218
2219
- if not isinstance (other , MultiIndex ):
2220
- if isinstance (other , tuple ):
2221
- other = [other ]
2222
- if not is_list_like (other ):
2219
+ if not isinstance (other , Index ):
2220
+ if not isinstance (other , tuple ):
2223
2221
return False
2222
+ other = Index ([other ])
2224
2223
2225
- try :
2226
- other = MultiIndex .from_tuples (other )
2227
- except :
2228
- return False
2224
+ if not isinstance (other , MultiIndex ):
2225
+ return array_equivalent (self ._values ,
2226
+ _values_from_object (_ensure_index (other )))
2229
2227
2230
2228
if self .nlevels != other .nlevels :
2231
2229
return False
Original file line number Diff line number Diff line change @@ -1447,22 +1447,9 @@ def test_to_hierarchical(self):
1447
1447
def test_bounds (self ):
1448
1448
self .index ._bounds
1449
1449
1450
- def test_equals (self ):
1451
-
1452
- for name , idx in compat .iteritems (self .indices ):
1453
- self .assertTrue (idx .equals (idx ))
1454
- self .assertTrue (idx .equals (idx .copy ()))
1455
- self .assertTrue (idx .equals (idx .astype (object )))
1456
- self .assertTrue (idx .equals (list (idx )))
1457
- self .assertTrue (idx .equals (np .array (idx )))
1458
-
1459
- same_values = Index (idx , dtype = object )
1460
- self .assertTrue (idx .equals (same_values ))
1461
- self .assertTrue (same_values .equals (idx ))
1462
-
1463
1450
def test_equals_multi (self ):
1464
1451
assert self .index .equals (self .index )
1465
- assert self .index .equals (self .index .values )
1452
+ assert not self .index .equals (self .index .values )
1466
1453
assert self .index .equals (Index (self .index .values ))
1467
1454
1468
1455
assert self .index .equal_levels (self .index )
You can’t perform that action at this time.
0 commit comments