Skip to content

Commit 03d4943

Browse files
String dtype: maybe_converts_object give precedence to nullable dtype
1 parent ecc451d commit 03d4943

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/_libs/lib.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,16 +2699,16 @@ def maybe_convert_objects(ndarray[object] objects,
26992699
seen.object_ = True
27002700

27012701
elif seen.str_:
2702-
if using_string_dtype() and is_string_array(objects, skipna=True):
2702+
if convert_to_nullable_dtype and is_string_array(objects, skipna=True):
27032703
from pandas.core.arrays.string_ import StringDtype
27042704

2705-
dtype = StringDtype(na_value=np.nan)
2705+
dtype = StringDtype()
27062706
return dtype.construct_array_type()._from_sequence(objects, dtype=dtype)
27072707

2708-
elif convert_to_nullable_dtype and is_string_array(objects, skipna=True):
2708+
elif using_string_dtype() and is_string_array(objects, skipna=True):
27092709
from pandas.core.arrays.string_ import StringDtype
27102710

2711-
dtype = StringDtype()
2711+
dtype = StringDtype(na_value=np.nan)
27122712
return dtype.construct_array_type()._from_sequence(objects, dtype=dtype)
27132713

27142714
seen.object_ = True

0 commit comments

Comments
 (0)