We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aba9ff7 commit 7f4079cCopy full SHA for 7f4079c
pandas/core/indexes/base.py
@@ -5471,12 +5471,11 @@ def equals(self, other: Any) -> bool:
5471
# quickly return if the lengths are different
5472
return False
5473
5474
- if (isinstance(self.dtype, StringDtype) or is_object_dtype(self.dtype)) and (
5475
- isinstance(other.dtype, StringDtype) or is_object_dtype(other.dtype)
5476
- ):
5477
- return array_equivalent(
5478
- self.astype("object")._values, other.astype("object")._values
5479
- )
+ if (
+ (isinstance(self.dtype, StringDtype) or is_object_dtype(self.dtype)) and
+ (isinstance(other.dtype, StringDtype) or is_object_dtype(other.dtype))
+ ):
+ return array_equivalent(self._values, other._values)
5480
5481
if (
5482
isinstance(self.dtype, StringDtype)
0 commit comments