def equals(self, other):
if self.is_(other):<EOL><INDENT>return True<EOL><DEDENT>if not isinstance(other, Index):<EOL><INDENT>return False<EOL><DEDENT>if is_object_dtype(self) and not is_object_dtype(other):<EOL><INDENT>return other.equals(self)<EOL><DEDENT>try:<EOL><INDENT>return array_equivalent(com.values_from_object(self),<EOL>com.values_from_object(other))<EOL><DEDENT>except Exception:<EOL><INDENT>return False<EOL><DEDENT>
Determine if two Index objects contain the same elements.