Skip to content

Commit 7d6377d

Browse files
authored
CLN: Update Cython data pointers for rolling apply (#34930)
* CLN: Update Cython data pointers for rolling apply
1 parent 4ce3e30 commit 7d6377d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pandas/_libs/window/aggregations.pyx

+2-8
Original file line numberDiff line numberDiff line change
@@ -1377,17 +1377,11 @@ def roll_generic_fixed(object obj,
13771377
output[i] = NaN
13781378

13791379
# remaining full-length windows
1380-
buf = <float64_t *>arr.data
1381-
bufarr = np.empty(win, dtype=float)
1382-
oldbuf = <float64_t *>bufarr.data
1383-
for i in range((win - offset), (N - offset)):
1384-
buf = buf + 1
1385-
bufarr.data = <char *>buf
1380+
for j, i in enumerate(range((win - offset), (N - offset)), 1):
13861381
if counts[i] >= minp:
1387-
output[i] = func(bufarr, *args, **kwargs)
1382+
output[i] = func(arr[j:j + win], *args, **kwargs)
13881383
else:
13891384
output[i] = NaN
1390-
bufarr.data = <char *>oldbuf
13911385

13921386
# truncated windows at the end
13931387
for i in range(int_max(N - offset, 0), N):

0 commit comments

Comments
 (0)