@@ -64,6 +64,10 @@ def _ensure_data(values, dtype=None):
64
64
65
65
"""
66
66
67
+ # short-circuit on object dtype requested
68
+ if is_object_dtype (dtype ):
69
+ return _ensure_object (values ), 'object' , 'object'
70
+
67
71
# we check some simple dtypes first
68
72
try :
69
73
if is_bool_dtype (values ) or is_bool_dtype (dtype ):
@@ -161,6 +165,7 @@ def _ensure_arraylike(values):
161
165
"""
162
166
if not isinstance (values , (np .ndarray , ABCCategorical ,
163
167
ABCIndexClass , ABCSeries )):
168
+ values = list (values )
164
169
inferred = lib .infer_dtype (values )
165
170
if inferred in ['mixed' , 'string' , 'unicode' ]:
166
171
values = lib .list_to_object_array (values )
@@ -392,10 +397,9 @@ def isin(comps, values):
392
397
" to isin(), you passed a "
393
398
"[{0}]" .format (type (values ).__name__ ))
394
399
395
- if not isinstance (values , (ABCIndex , ABCSeries , np .ndarray )):
396
- values = lib .list_to_object_array (list (values ))
397
-
400
+ comps = _ensure_arraylike (comps )
398
401
comps , dtype , _ = _ensure_data (comps )
402
+ values = _ensure_arraylike (values )
399
403
values , _ , _ = _ensure_data (values , dtype = dtype )
400
404
401
405
# GH11232
0 commit comments