Skip to content

Commit

Permalink
PERF: Avoid call to list in isin (#49192)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach committed Oct 20, 2022
1 parent aa051b8 commit 14b2b61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,13 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> npt.NDArray[np.bool_]:
)

if not isinstance(values, (ABCIndex, ABCSeries, ABCExtensionArray, np.ndarray)):
orig_values = values
values = _ensure_arraylike(list(values))
orig_values = list(values)
values = _ensure_arraylike(orig_values)

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

elif isinstance(values, ABCMultiIndex):
# Avoid raising in extract_array
Expand Down

0 comments on commit 14b2b61

Please sign in to comment.