Skip to content

Commit c19fb29

Browse files
committed
use arrow for bool array
1 parent c3284ba commit c19fb29

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pandas/core/arrays/string_arrow.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,19 @@ def _from_sequence(
212212
pa_arr = pa.array(result, mask=na_values, type=pa.large_string())
213213
elif isinstance(scalars, ArrowExtensionArray):
214214
pa_type = scalars._pa_array.type
215-
# Use PyArrow's native cast for integer and string types where
216-
# the string representation matches Python's str().
217-
# Float and boolean have different representations in PyArrow
218-
# (e.g., 1.0 -> "1" instead of "1.0", True -> "true" instead of "True")
215+
# Use PyArrow's native cast for integer, string, and boolean types.
216+
# Float has different representation in PyArrow: 1.0 -> "1" instead
217+
# of "1.0", and uses different scientific notation (1e+10 vs 1e10).
218+
# Boolean needs capitalize (true -> True, false -> False).
219219
if (
220220
pa.types.is_integer(pa_type)
221221
or pa.types.is_large_string(pa_type)
222222
or pa.types.is_string(pa_type)
223+
or pa.types.is_boolean(pa_type)
223224
):
224225
pa_arr = pc.cast(scalars._pa_array, pa.large_string())
226+
if pa.types.is_boolean(pa_type):
227+
pa_arr = pc.utf8_capitalize(pa_arr)
225228
else:
226229
# Fall back for types where PyArrow's string representation
227230
# differs from Python's str()

0 commit comments

Comments
 (0)