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

Function roll_table

pandas/core/window/numba_.py:220–239  ·  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

218
219 @numba.jit(nopython=nopython, nogil=nogil, parallel=parallel)
220 def roll_table(
221 values: np.ndarray,
222 begin: np.ndarray,
223 end: np.ndarray,
224 minimum_periods: int,
225 *args: Any,
226 ):
227 result = np.empty((len(begin), values.shape[1]))
228 min_periods_mask = np.empty(result.shape)
229 for i in numba.prange(len(result)):
230 start = begin[i]
231 stop = end[i]
232 window = values[start:stop]
233 count_nan = np.sum(np.isnan(window), axis=0)
234 nan_mask = len(window) - count_nan >= minimum_periods
235 if nan_mask.any():
236 result[i, :] = numba_func(window, *args)
237 min_periods_mask[i, :] = nan_mask
238 result = np.where(min_periods_mask, result, np.nan)
239 return result
240
241 return roll_table
242

Callers

nothing calls this directly

Calls 5

numba_funcFunction · 0.50
emptyMethod · 0.45
sumMethod · 0.45
anyMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected