Skip to content

Commit 07e1755

Browse files
committed
PERF: Restore old performances with .isin() on columns typed as np.uint64
1 parent 38dd653 commit 07e1755

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/core/algorithms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,11 @@ def isin(comps: ListLike, values: ListLike) -> npt.NDArray[np.bool_]:
511511
len(values) > 0
512512
and values.dtype.kind in "iufcb"
513513
and not is_signed_integer_dtype(comps)
514+
and not isna(values).any()
515+
and not np.isinf(values).any()
514516
):
515-
# GH#46485 Use object to avoid upcast to float64 later
516517
# TODO: Share with _find_common_type_compat
517-
values = construct_1d_object_array_from_listlike(orig_values)
518+
values = np.asarray(list(orig_values), dtype=np.unsignedinteger)
518519

519520
elif isinstance(values, ABCMultiIndex):
520521
# Avoid raising in extract_array

0 commit comments

Comments
 (0)