Skip to content

Commit fc4653d

Browse files
committed
BUG fix GH#61155 v2
1 parent 6f5c4d4 commit fc4653d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/_libs/lib.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,10 @@ cpdef ndarray[object] ensure_string_array(
769769
return out
770770
arr = arr.to_numpy(dtype=object)
771771
elif not util.is_array(arr):
772-
arr = np.array(arr, dtype="object")
772+
# GH#61155: Guarantee a 1-d result when array is a list of lists
773+
input_arr = arr
774+
arr = np.empty(len(arr), dtype="object")
775+
arr[:] = input_arr
773776

774777
result = np.asarray(arr, dtype="object")
775778

0 commit comments

Comments
 (0)