Skip to content

Commit ce28027

Browse files
committed
simplify
1 parent 73a95d2 commit ce28027

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ def _from_sequence_of_strings(
369369
scalars = strings.cast(pa.int64())
370370
except pa.ArrowInvalid:
371371
pass
372-
373372
elif pa.types.is_time(pa_type):
374373
from pandas.core.tools.times import to_time
375374

@@ -397,18 +396,10 @@ def _from_sequence_of_strings(
397396
from pandas.core.tools.numeric import to_numeric
398397

399398
scalars = to_numeric(strings, errors="raise")
400-
if not pa.types.is_decimal(pa_type) and isinstance(
401-
strings, (pa.Array, pa.ChunkedArray)
402-
):
403-
# TODO: figure out why doing this cast breaks with decimal dtype
404-
# in test_from_sequence_of_strings_pa_array
405-
mask = strings.is_null()
406-
scalars = pa.array(scalars, mask=np.array(mask), type=pa_type)
407-
# TODO: could we just do strings.cast(pa_type)?
408-
elif isinstance(strings, (pa.Array, pa.ChunkedArray)):
399+
if isinstance(strings, (pa.Array, pa.ChunkedArray)):
409400
scalars = strings.cast(pa_type)
410401
elif mask is not None:
411-
scalars = pa.array(scalars, mask=mask.view(bool), type=pa_type)
402+
scalars = pa.array(scalars, mask=mask, type=pa_type)
412403

413404
else:
414405
raise NotImplementedError(

0 commit comments

Comments
 (0)