MCPcopy
hub / github.com/pandas-dev/pandas / roll_apply

Function roll_apply

pandas/core/window/numba_.py:59–76  ·  view source on GitHub ↗
(
        values: np.ndarray,
        begin: np.ndarray,
        end: np.ndarray,
        minimum_periods: int,
        *args: Any,
    )

Source from the content-addressed store, hash-verified

57
58 @numba.jit(nopython=nopython, nogil=nogil, parallel=parallel)
59 def roll_apply(
60 values: np.ndarray,
61 begin: np.ndarray,
62 end: np.ndarray,
63 minimum_periods: int,
64 *args: Any,
65 ) -> np.ndarray:
66 result = np.empty(len(begin))
67 for i in numba.prange(len(result)):
68 start = begin[i]
69 stop = end[i]
70 window = values[start:stop]
71 count_nan = np.sum(np.isnan(window))
72 if len(window) - count_nan >= minimum_periods:
73 result[i] = numba_func(window, *args)
74 else:
75 result[i] = np.nan
76 return result
77
78 return roll_apply
79

Callers

nothing calls this directly

Calls 3

numba_funcFunction · 0.50
emptyMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected