Skip to content

Commit 6810ff2

Browse files
committed
PERF: restore performance for unsorted CategoricalDtype comparison
1 parent a4c19e7 commit 6810ff2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/dtypes/dtypes.py

+3
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ def __eq__(self, other: Any) -> bool:
406406
# but same order is not necessary. There is no distinction between
407407
# ordered=False and ordered=None: CDT(., False) and CDT(., None)
408408
# will be equal if they have the same categories.
409+
if self.categories.equals(other.categories):
410+
# Check and see if they happen to be identical categories
411+
return True
409412
return hash(self) == hash(other)
410413

411414
def __repr__(self):

0 commit comments

Comments
 (0)