diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index e6847b380a7e8..2d457dd9004d1 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -511,10 +511,11 @@ def isin(comps: ListLike, values: ListLike) -> npt.NDArray[np.bool_]: len(values) > 0 and values.dtype.kind in "iufcb" and not is_signed_integer_dtype(comps) + and not isna(values).any() + and not np.isinf(values).any() ): - # GH#46485 Use object to avoid upcast to float64 later # TODO: Share with _find_common_type_compat - values = construct_1d_object_array_from_listlike(orig_values) + values = np.asarray(list(orig_values), dtype=np.unsignedinteger) elif isinstance(values, ABCMultiIndex): # Avoid raising in extract_array