Initializing playground…
← Back to roadmap

Rolling Apply & Multi-Aggregation

Standalone functions for applying custom aggregation logic over sliding windows, mirroring pandas.Series.rolling().apply() and Rolling.agg() .

1. rollingApply — Custom Function Per Window

Apply any aggregation function to each rolling window. The function receives the valid (non-null, non-NaN) numeric values in the window and must return a single number.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Options

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

2. rollingAgg — Multiple Aggregations at Once

Apply several named aggregation functions in a single pass over a Series, returning a DataFrame where each column holds one aggregation result.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

3. dataFrameRollingApply — Apply Per Column

Apply a single custom function independently to each column of a DataFrame, returning a new DataFrame of the same shape.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

4. dataFrameRollingAgg — Multi-Agg Per Column

Apply multiple named aggregation functions to every column of a DataFrame. The result has columns named {originalColumn}_{aggName}.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Use case: Bollinger Band width

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent