Skip to content

Commit 09e07d2

Browse files
committed
PERF: fixup
1 parent dc8d35a commit 09e07d2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/core/indexes/category.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
is_scalar)
1414
from pandas.core.dtypes.dtypes import CategoricalDtype
1515
from pandas.core.dtypes.generic import ABCCategorical, ABCSeries
16-
from pandas.core.dtypes.missing import array_equivalent, isna
16+
from pandas.core.dtypes.missing import isna
1717

1818
from pandas.core import accessor
1919
from pandas.core.algorithms import take_1d
@@ -283,7 +283,13 @@ def equals(self, other):
283283

284284
try:
285285
other = self._is_dtype_compat(other)
286-
return array_equivalent(self._data, other)
286+
# changed from array_equivalent to avoid a ValueError
287+
# from trying to convert NaT.
288+
# This should also be faster, since we don't coerce to
289+
# arryays
290+
if isinstance(other, type(self)):
291+
other = other._data
292+
return self._data.equals(other)
287293
except (TypeError, ValueError):
288294
pass
289295

0 commit comments

Comments
 (0)