Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6718,7 +6718,20 @@ def _binop(self, other: Series, func, level=None, fill_value=None) -> Series:
this_vals, other_vals = ops.fill_binop(this._values, other._values, fill_value)

with np.errstate(all="ignore"):
result = func(this_vals, other_vals)
# GH#63250: Use arithmetic_op for arithmetic operations to ensure
# consistent behavior with dunder methods (includes _bool_arith_check)
# But use direct func call for comparison operations (gt, lt, etc.)
if func in (
operator.gt,
operator.ge,
operator.lt,
operator.le,
operator.eq,
operator.ne,
):
result = func(this_vals, other_vals)
else:
result = ops.arithmetic_op(this_vals, other_vals, func)

name = ops.get_op_result_name(self, other)

Expand Down
Loading