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_]:
541
541
elif isinstance (values .dtype , ExtensionDtype ):
542
542
return isin (np .asarray (comps_array ), np .asarray (values ))
543
543
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
-
552
544
# GH16012
553
545
# Ensure np.isin doesn't get object types or it *may* throw an exception
554
546
# Albeit hashmap has O(1) look-up (vs. O(logn) in sorted array),
555
547
# isin is faster for small sizes
556
548
549
+ # GH60678
550
+ # Ensure values don't contain <NA>, otherwise it throws exception with np.in1d
551
+
557
552
if (
558
553
len (comps_array ) > _MINIMUM_COMP_ARR_LEN
559
554
and len (values ) <= 26
560
555
and comps_array .dtype != object
561
- and not values_contains_NA
556
+ and not any ( v is NA for v in values )
562
557
):
563
558
# If the values include nan we need to check for nan explicitly
564
559
# since np.nan it not equal to np.nan
You can’t perform that action at this time.
0 commit comments