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>try:<EOL><INDENT>other = self._is_dtype_compat(other)<EOL>if isinstance(other, type(self)):<EOL><INDENT>other = other._data<EOL><DEDENT>return self._data.equals(other)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT>return False<EOL>
Determine if two CategorialIndex objects contain the same elements.