Skip to content

Commit 14b2b61

Browse files
authored
PERF: Avoid call to list in isin (#49192)
1 parent aa051b8 commit 14b2b61

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/algorithms.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -462,13 +462,13 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> npt.NDArray[np.bool_]:
462462
)
463463

464464
if not isinstance(values, (ABCIndex, ABCSeries, ABCExtensionArray, np.ndarray)):
465-
orig_values = values
466-
values = _ensure_arraylike(list(values))
465+
orig_values = list(values)
466+
values = _ensure_arraylike(orig_values)
467467

468468
if is_numeric_dtype(values) and not is_signed_integer_dtype(comps):
469469
# GH#46485 Use object to avoid upcast to float64 later
470470
# TODO: Share with _find_common_type_compat
471-
values = construct_1d_object_array_from_listlike(list(orig_values))
471+
values = construct_1d_object_array_from_listlike(orig_values)
472472

473473
elif isinstance(values, ABCMultiIndex):
474474
# Avoid raising in extract_array

0 commit comments

Comments
 (0)