Skip to content

Commit

Permalink
PERF: fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger committed Nov 30, 2018
1 parent dc8d35a commit 09e07d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
is_scalar)
from pandas.core.dtypes.dtypes import CategoricalDtype
from pandas.core.dtypes.generic import ABCCategorical, ABCSeries
from pandas.core.dtypes.missing import array_equivalent, isna
from pandas.core.dtypes.missing import isna

from pandas.core import accessor
from pandas.core.algorithms import take_1d
Expand Down Expand Up @@ -283,7 +283,13 @@ def equals(self, other):

try:
other = self._is_dtype_compat(other)
return array_equivalent(self._data, other)
# changed from array_equivalent to avoid a ValueError
# from trying to convert NaT.
# This should also be faster, since we don't coerce to
# arryays
if isinstance(other, type(self)):
other = other._data
return self._data.equals(other)
except (TypeError, ValueError):
pass

Expand Down

0 comments on commit 09e07d2

Please sign in to comment.