Skip to content

Commit 857e020

Browse files
committed
TST: use list_to_object_array when we can
1 parent 52c1817 commit 857e020

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/core/common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,12 @@ def _asarray_tuplesafe(values, dtype=None):
659659
result = np.asarray(values, dtype=object)
660660

661661
if result.ndim == 2:
662-
result = np.empty(len(values), dtype=object)
663-
result[:] = values
662+
if isinstance(values, list):
663+
return lib.list_to_object_array(values)
664+
else:
665+
# give it our best shot
666+
result = np.empty(len(values), dtype=object)
667+
result[:] = values
664668

665669
return result
666670

0 commit comments

Comments
 (0)