Skip to content

Commit 7273396

Browse files
committed
Edited pyarrow catch to be more specific
1 parent bca56fe commit 7273396

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,13 @@ def _evaluate_op_method(self, other, op, arrow_funcs) -> Self:
906906
):
907907
if op in [operator.add, roperator.radd]:
908908
sep = pa.scalar("", type=pa_type)
909-
if is_scalar(other) or isinstance(other, pa.Scalar):
910-
if len(other) == 0 or isna(other).any():
911-
other = other.cast(pa_type)
909+
if (
910+
pa.types.is_string(other.type)
911+
or pa.types.is_large_string(other.type)
912+
or pa.types.is_binary(other.type)
913+
or isna(other).all()
914+
):
915+
other = other.cast(pa_type)
912916
try:
913917
if op is operator.add:
914918
result = pc.binary_join_element_wise(self._pa_array, other, sep)

0 commit comments

Comments
 (0)