@@ -64,6 +64,10 @@ def _ensure_data(values, dtype=None):
6464
6565 """
6666
67+ # short-circuit on object dtype requested
68+ if is_object_dtype (dtype ):
69+ return _ensure_object (values ), 'object' , 'object'
70+
6771 # we check some simple dtypes first
6872 try :
6973 if is_bool_dtype (values ) or is_bool_dtype (dtype ):
@@ -161,6 +165,7 @@ def _ensure_arraylike(values):
161165 """
162166 if not isinstance (values , (np .ndarray , ABCCategorical ,
163167 ABCIndexClass , ABCSeries )):
168+ values = list (values )
164169 inferred = lib .infer_dtype (values )
165170 if inferred in ['mixed' , 'string' , 'unicode' ]:
166171 values = lib .list_to_object_array (values )
@@ -392,10 +397,9 @@ def isin(comps, values):
392397 " to isin(), you passed a "
393398 "[{0}]" .format (type (values ).__name__ ))
394399
395- if not isinstance (values , (ABCIndex , ABCSeries , np .ndarray )):
396- values = lib .list_to_object_array (list (values ))
397-
400+ comps = _ensure_arraylike (comps )
398401 comps , dtype , _ = _ensure_data (comps )
402+ values = _ensure_arraylike (values )
399403 values , _ , _ = _ensure_data (values , dtype = dtype )
400404
401405 # GH11232
0 commit comments