Skip to content

Commit 7de939b

Browse files
topper-123victor
authored and
victor
committed
improve speed of nans in CategoricalIndex (pandas-dev#21493)
1 parent c847f7c commit 7de939b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/core/indexes/category.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def __contains__(self, key):
326326
hash(key)
327327

328328
if isna(key): # if key is a NaN, check if any NaN is in self.
329-
return self.isna().any()
329+
return self.hasnans
330330

331331
# is key in self.categories? Then get its location.
332332
# If not (i.e. KeyError), it logically can't be in self either

0 commit comments

Comments
 (0)