Skip to content

Commit 681cc1e

Browse files
committed
simplify
1 parent 599f775 commit 681cc1e

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
@@ -371,7 +371,6 @@ def _from_sequence_of_strings(
371371
scalars = strings.cast(pa.int64())
372372
except pa.ArrowInvalid:
373373
pass
374-
375374
elif pa.types.is_time(pa_type):
376375
from pandas.core.tools.times import to_time
377376

@@ -399,18 +398,10 @@ def _from_sequence_of_strings(
399398
from pandas.core.tools.numeric import to_numeric
400399

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

415406
else:
416407
raise NotImplementedError(

0 commit comments

Comments
 (0)