@@ -4120,7 +4120,6 @@ def __getitem__(self, key):
4120
4120
if com .is_bool_indexer (key ):
4121
4121
key = np .asarray (key , dtype = bool )
4122
4122
4123
- key = com .values_from_object (key )
4124
4123
result = getitem (key )
4125
4124
if not is_scalar (result ):
4126
4125
if np .ndim (result ) > 1 :
@@ -4245,19 +4244,19 @@ def equals(self, other) -> bool:
4245
4244
if not isinstance (other , Index ):
4246
4245
return False
4247
4246
4248
- if is_object_dtype (self ) and not is_object_dtype (other ):
4247
+ if is_object_dtype (self . dtype ) and not is_object_dtype (other . dtype ):
4249
4248
# if other is not object, use other's logic for coercion
4250
4249
return other .equals (self )
4251
4250
4252
4251
if isinstance (other , ABCMultiIndex ):
4253
4252
# d-level MultiIndex can equal d-tuple Index
4254
- if not is_object_dtype (self .dtype ):
4255
- if self .nlevels != other .nlevels :
4256
- return False
4253
+ return other .equals (self )
4257
4254
4258
- return array_equivalent (
4259
- com .values_from_object (self ), com .values_from_object (other )
4260
- )
4255
+ if is_extension_array_dtype (other .dtype ):
4256
+ # All EA-backed Index subclasses override equals
4257
+ return other .equals (self )
4258
+
4259
+ return array_equivalent (self ._values , other ._values )
4261
4260
4262
4261
def identical (self , other ) -> bool :
4263
4262
"""
0 commit comments