Skip to content

Commit 6f5c4d4

Browse files
committed
BUG: Fix array creation for string dtype with inconsistent list lengths (pandas-dev#61155)
1 parent a505d35 commit 6f5c4d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/arrays/string_.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,8 @@ def _from_sequence(
655655
# zero_copy_only to True which caused problems see GH#52076
656656
scalars = np.array(scalars)
657657
# convert non-na-likes to str, and nan-likes to StringDtype().na_value
658-
if isinstance(scalars, list) and all(isinstance(x,list) for x in scalars):
659-
scalars =[str(x) for x in scalars]
658+
if isinstance(scalars, list) and all(isinstance(x, list) for x in scalars):
659+
scalars = [str(x) for x in scalars]
660660
result = lib.ensure_string_array(scalars, na_value=na_value, copy=copy)
661661

662662
# Manually creating new array avoids the validation step in the __init__, so is

0 commit comments

Comments
 (0)