Skip to content

Commit c2b1337

Browse files
authored
REF: ensure_arraylike in algos.isin (pandas-dev#38004)
1 parent 4c84e12 commit c2b1337

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/algorithms.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def _ensure_arraylike(values):
218218
"""
219219
if not is_array_like(values):
220220
inferred = lib.infer_dtype(values, skipna=False)
221-
if inferred in ["mixed", "string"]:
221+
if inferred in ["mixed", "string", "mixed-integer"]:
222+
# "mixed-integer" to ensure we do not cast ["ss", 42] to str GH#22160
222223
if isinstance(values, tuple):
223224
values = list(values)
224225
values = construct_1d_object_array_from_listlike(values)
@@ -424,6 +425,7 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray:
424425
values = construct_1d_object_array_from_listlike(list(values))
425426
# TODO: could use ensure_arraylike here
426427

428+
comps = _ensure_arraylike(comps)
427429
comps = extract_array(comps, extract_numpy=True)
428430
if is_categorical_dtype(comps):
429431
# TODO(extension)

0 commit comments

Comments
 (0)