def equals(self, other: Any) -> bool:
    '\n        Determines if two Index objects contain the same elements.\n        '
    if self.is_(other):
        return True
    if (not isinstance(other, Index)):
        return False
    elif (other.dtype.kind in ['f', 'i', 'u', 'c']):
        return False
    elif (not isinstance(other, type(self))):
        should_try = False
        inferable = self._data._infer_matches
        if (other.dtype == object):
            should_try = (other.inferred_type in inferable)
        elif is_categorical_dtype(other.dtype):
            other = cast('CategoricalIndex', other)
            should_try = (other.categories.inferred_type in inferable)
        if should_try:
            try:
                other = type(self)(other)
            except (ValueError, TypeError, OverflowError):
                return False
    if (not is_dtype_equal(self.dtype, other.dtype)):
        return False
    return np.array_equal(self.asi8, other.asi8)
Determines if two Index objects contain the same elements.
def equals(self, other: Any) -> bool:
    '\n        \n        '
    if self.is_(other):
        return True
    if (not isinstance(other, Index)):
        return False
    elif (other.dtype.kind in ['f', 'i', 'u', 'c']):
        return False
    elif (not isinstance(other, type(self))):
        should_try = False
        inferable = self._data._infer_matches
        if (other.dtype == object):
            should_try = (other.inferred_type in inferable)
        elif is_categorical_dtype(other.dtype):
            other = cast('CategoricalIndex', other)
            should_try = (other.categories.inferred_type in inferable)
        if should_try:
            try:
                other = type(self)(other)
            except (ValueError, TypeError, OverflowError):
                return False
    if (not is_dtype_equal(self.dtype, other.dtype)):
        return False
    return np.array_equal(self.asi8, other.asi8)