def equals(self, other):
if self.is_(other):<EOL><INDENT>return True<EOL><DEDENT>if not isinstance(other, ABCIndexClass):<EOL><INDENT>return False<EOL><DEDENT>elif not isinstance(other, type(self)):<EOL><INDENT>try:<EOL><INDENT>other = type(self)(other)<EOL><DEDENT>except Exception:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>if not is_dtype_equal(self.dtype, other.dtype):<EOL><INDENT>return False<EOL><DEDENT>elif is_period_dtype(self):<EOL><INDENT>if not is_period_dtype(other):<EOL><INDENT>return False<EOL><DEDENT>if self.freq != other.freq:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return np.array_equal(self.asi8, other.asi8)<EOL>
Determines if two Index objects contain the same elements.