Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pandas/core/indexes/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ def astype(self, dtype, copy=True):
def _isnan(self) -> np.ndarray:
return self._data.isna()

@doc(Index.equals)
def equals(self, other) -> bool:
# Dispatch to the ExtensionArray's .equals method.
if self.is_(other):
return True

if not isinstance(other, type(self)):
return False

return self._data.equals(other._data)


class NDArrayBackedExtensionIndex(ExtensionIndex):
"""
Expand Down
12 changes: 0 additions & 12 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,18 +970,6 @@ def _format_space(self) -> str:
def argsort(self, *args, **kwargs) -> np.ndarray:
return np.lexsort((self.right, self.left))

def equals(self, other: object) -> bool:
"""
Determines if two IntervalIndex objects contain the same elements.
"""
if self.is_(other):
return True

if not isinstance(other, IntervalIndex):
return False

return self._data.equals(other._data)

# --------------------------------------------------------------------
# Set Operations

Expand Down