Skip to content

Commit a41fccd

Browse files
authored
PERF: Improve performance for ser + range (#51518)
1 parent d2dc56f commit a41fccd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pandas/core/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,8 @@ def _arith_method(self, other, op):
13401340
rvalues = extract_array(other, extract_numpy=True, extract_range=True)
13411341
rvalues = ops.maybe_prepare_scalar_for_op(rvalues, lvalues.shape)
13421342
rvalues = ensure_wrapped_if_datetimelike(rvalues)
1343+
if isinstance(rvalues, range):
1344+
rvalues = np.arange(rvalues.start, rvalues.stop, rvalues.step)
13431345

13441346
with np.errstate(all="ignore"):
13451347
result = ops.arithmetic_op(lvalues, rvalues, op)

0 commit comments

Comments
 (0)