Skip to content

Rolling

polars_ts.features.rolling

Rolling window feature generation for time series data.

rolling_features(df, windows, aggs=None, target_col='y', id_col='unique_id', time_col='ds', center=False, min_samples=None)

Create rolling window features for a target column per group.

Parameters

df Input DataFrame with time series data. windows List of window sizes. aggs Aggregation functions to apply. Defaults to ["mean", "std", "min", "max"]. Supported: mean, std, min, max, sum, median, var. target_col Column to compute rolling features on. id_col Column identifying each time series. time_col Column with timestamps for ordering. center Whether the rolling window is centred. min_samples Minimum number of non-null values required. Defaults to the window size when None.

Returns

pl.DataFrame Original DataFrame with rolling feature columns appended.