Skip to content

Commit 4617108

Browse files
committed
Removed type-casting shenanigans in array.py
1 parent 7e23b65 commit 4617108

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,11 +906,6 @@ 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 not (is_scalar(other) or isinstance(other, pa.Scalar)):
910-
if len(other) == 0 or isna(other).any():
911-
other = other.cast(pa_type)
912-
elif isna(other):
913-
other = other.cast(pa_type)
914909
try:
915910
if op is operator.add:
916911
result = pc.binary_join_element_wise(self._pa_array, other, sep)

pandas/tests/arrays/integer/test_arithmetic.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,6 @@ def test_error_invalid_values(data, all_arithmetic_operators):
197197
# assert_almost_equal stricter, but the expected with pd.NA seems
198198
# more-correct than np.nan here.
199199
tm.assert_series_equal(res, expected)
200-
elif (
201-
all_arithmetic_operators
202-
in [
203-
"__add__",
204-
"__radd__",
205-
]
206-
and pd.options.future.infer_string
207-
):
208-
res = ops(str_ser)
209-
if all_arithmetic_operators == "__radd__":
210-
expected = pd.Series(
211-
[np.nan if pd.isna(x) == 1 else "foo" + str(x) for x in data],
212-
index=s.index,
213-
)
214-
else:
215-
expected = pd.Series(
216-
[np.nan if pd.isna(x) == 1 else str(x) + "foo" for x in data],
217-
index=s.index,
218-
)
219-
tm.assert_series_equal(res, expected)
220200
else:
221201
with tm.external_error_raised(TypeError):
222202
ops(str_ser)

0 commit comments

Comments
 (0)