Function: rolling()
ts
function rolling(values, options, fn?, functionArgs?, times?): number[];A rolling statistic (pandas' series.rolling(window, min_periods, center, win_type).fn()): for each point, fn of the present values in its window. times (ms) are the index for a time-span window and must be sorted.
Parameters
| Parameter | Type | Default value |
|---|---|---|
values | ArrayLike<number> | undefined |
options | RollingOptions | undefined |
fn | WindowFunction | 'mean' |
functionArgs | Readonly<Record<string, unknown>> | {} |
times? | ArrayLike<number> | undefined |
Returns
number[]
Example
ts
rolling([1, 2, NaN, 4, 5], { window: 2 }, 'mean'); // [NaN, 1.5, NaN, NaN, 4.5]