Skip to content

Commit

Permalink
PERF: restore performance for unsorted CategoricalDtype comparison (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
qwhelan authored and jreback committed Jul 18, 2019
1 parent f2886c1 commit 1857bff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ def __eq__(self, other: Any) -> bool:
# but same order is not necessary. There is no distinction between
# ordered=False and ordered=None: CDT(., False) and CDT(., None)
# will be equal if they have the same categories.
if (
self.categories.dtype == other.categories.dtype
and self.categories.equals(other.categories)
):
# Check and see if they happen to be identical categories
return True
return hash(self) == hash(other)

def __repr__(self):
Expand Down

0 comments on commit 1857bff

Please sign in to comment.