Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN: Update Cython data pointers for rolling apply #34930

Merged
Merged
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
10 changes: 2 additions & 8 deletions pandas/_libs/window/aggregations.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1377,17 +1377,11 @@ def roll_generic_fixed(object obj,
output[i] = NaN

# remaining full-length windows
buf = <float64_t *>arr.data
bufarr = np.empty(win, dtype=float)
oldbuf = <float64_t *>bufarr.data
for i in range((win - offset), (N - offset)):
buf = buf + 1
bufarr.data = <char *>buf
for j, i in enumerate(range((win - offset), (N - offset)), 1):
if counts[i] >= minp:
output[i] = func(bufarr, *args, **kwargs)
output[i] = func(arr[j:j + win], *args, **kwargs)
else:
output[i] = NaN
bufarr.data = <char *>oldbuf

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