Skip to content

Commit eb4be94

Browse files
mroeschkeMatt Roeschke
and
Matt Roeschke
authored
REF: Use more memory views in rolling aggregations (#37886)
Co-authored-by: Matt Roeschke <mroeschke@housecanary.com>
1 parent c77fc35 commit eb4be94

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/_libs/window/aggregations.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ cdef inline void remove_sum(float64_t val, int64_t *nobs, float64_t *sum_x,
136136
sum_x[0] = t
137137

138138

139-
def roll_sum(ndarray[float64_t] values, ndarray[int64_t] start,
139+
def roll_sum(const float64_t[:] values, ndarray[int64_t] start,
140140
ndarray[int64_t] end, int64_t minp):
141141
cdef:
142142
float64_t sum_x = 0, compensation_add = 0, compensation_remove = 0
@@ -240,7 +240,7 @@ cdef inline void remove_mean(float64_t val, Py_ssize_t *nobs, float64_t *sum_x,
240240
neg_ct[0] = neg_ct[0] - 1
241241

242242

243-
def roll_mean(ndarray[float64_t] values, ndarray[int64_t] start,
243+
def roll_mean(const float64_t[:] values, ndarray[int64_t] start,
244244
ndarray[int64_t] end, int64_t minp):
245245
cdef:
246246
float64_t val, compensation_add = 0, compensation_remove = 0, sum_x = 0
@@ -361,7 +361,7 @@ cdef inline void remove_var(float64_t val, float64_t *nobs, float64_t *mean_x,
361361
ssqdm_x[0] = 0
362362

363363

364-
def roll_var(ndarray[float64_t] values, ndarray[int64_t] start,
364+
def roll_var(const float64_t[:] values, ndarray[int64_t] start,
365365
ndarray[int64_t] end, int64_t minp, int ddof=1):
366366
"""
367367
Numerically stable implementation using Welford's method.
@@ -772,7 +772,7 @@ def roll_kurt(ndarray[float64_t] values, ndarray[int64_t] start,
772772
# Rolling median, min, max
773773

774774

775-
def roll_median_c(ndarray[float64_t] values, ndarray[int64_t] start,
775+
def roll_median_c(const float64_t[:] values, ndarray[int64_t] start,
776776
ndarray[int64_t] end, int64_t minp):
777777
# GH 32865. win argument kept for compatibility
778778
cdef:
@@ -1032,7 +1032,7 @@ interpolation_types = {
10321032
}
10331033

10341034

1035-
def roll_quantile(ndarray[float64_t, cast=True] values, ndarray[int64_t] start,
1035+
def roll_quantile(const float64_t[:] values, ndarray[int64_t] start,
10361036
ndarray[int64_t] end, int64_t minp,
10371037
float64_t quantile, str interpolation):
10381038
"""

0 commit comments

Comments
 (0)