Skip to content

Commit 9f8790d

Browse files
committed
BUG: Index._id
1 parent c0c3516 commit 9f8790d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/core/indexes/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _outer_indexer(self, left, right):
220220

221221
_typ = "index"
222222
_data: Union[ExtensionArray, np.ndarray]
223-
_id: _Identity
223+
_id: Optional[_Identity] = None
224224
_name: Label = None
225225
# MultiIndex.levels previously allowed setting the index name. We
226226
# don't allow this anymore, and raise if it happens rather than
@@ -541,10 +541,10 @@ def is_(self, other) -> bool:
541541
--------
542542
Index.identical : Works like ``Index.is_`` but also checks metadata.
543543
"""
544-
try:
545-
return self._id is other._id
546-
except AttributeError:
547-
return False
544+
if self is other:
545+
return True
546+
else:
547+
return self._id is not None and self._id is getattr(other, "_id", Ellipsis)
548548

549549
def _reset_identity(self) -> None:
550550
"""

0 commit comments

Comments
 (0)