File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -541,24 +541,19 @@ def isin(comps: ListLike, values: ListLike) -> npt.NDArray[np.bool_]:
541541 elif isinstance (values .dtype , ExtensionDtype ):
542542 return isin (np .asarray (comps_array ), np .asarray (values ))
543543
544- # GH60678
545- # Ensure values don't contain <NA>, otherwise it throws exception with np.in1d
546-
547- values_contains_NA = False
548-
549- if comps_array .dtype != object and len (values ) <= 26 :
550- values_contains_NA = any (v is NA for v in values )
551-
552544 # GH16012
553545 # Ensure np.isin doesn't get object types or it *may* throw an exception
554546 # Albeit hashmap has O(1) look-up (vs. O(logn) in sorted array),
555547 # isin is faster for small sizes
556548
549+ # GH60678
550+ # Ensure values don't contain <NA>, otherwise it throws exception with np.in1d
551+
557552 if (
558553 len (comps_array ) > _MINIMUM_COMP_ARR_LEN
559554 and len (values ) <= 26
560555 and comps_array .dtype != object
561- and not values_contains_NA
556+ and not any ( v is NA for v in values )
562557 ):
563558 # If the values include nan we need to check for nan explicitly
564559 # since np.nan it not equal to np.nan
You can’t perform that action at this time.
0 commit comments