Overview
Lag transforms allow you to compute lagged features and rolling statistics over grouped time series data. All transforms work with theGroupedArray structure and provide both transform() and update() methods for batch processing and incremental updates.
Basic Example
Rolling Window Examples
Rolling window operations compute statistics over a sliding window of observations.Seasonal Rolling Examples
Seasonal rolling operations compute statistics over windows that respect seasonality patterns.Expanding Window Examples
Expanding windows compute cumulative statistics from the start of each series.Exponentially Weighted Mean Example
The exponentially weighted mean gives more weight to recent observations.Update Method for Incremental Processing
All transforms provide anupdate() method for efficient incremental computation when new data arrives.
Available lag transformations
Lag
_BaseLagTransform
Simple lag operator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset | required |
RollingMean
Bases: _RollingBase
Rolling Mean
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation. | required |
window_size | int | Length of the rolling window. | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
RollingStd
Bases: _RollingBase
Rolling Standard Deviation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation. | required |
window_size | int | Length of the rolling window. | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
RollingMin
Bases: _RollingBase
Rolling Minimum
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation. | required |
window_size | int | Length of the rolling window. | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
RollingMax
Bases: _RollingBase
Rolling Maximum
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation. | required |
window_size | int | Length of the rolling window. | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
RollingQuantile
_RollingBase
Rolling quantile
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation | required |
p | float | Quantile to compute | required |
window_size | int | Length of the rolling window | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
SeasonalRollingMean
Bases: _SeasonalRollingBase
Seasonal rolling Mean
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation | required |
season_length | int | Length of the seasonal period, e.g. 7 for weekly data | required |
window_size | int | Length of the rolling window | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
SeasonalRollingStd
Bases: _SeasonalRollingBase
Seasonal rolling Standard Deviation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation | required |
season_length | int | Length of the seasonal period, e.g. 7 for weekly data | required |
window_size | int | Length of the rolling window | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
SeasonalRollingMin
Bases: _SeasonalRollingBase
Seasonal rolling Minimum
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation | required |
season_length | int | Length of the seasonal period, e.g. 7 for weekly data | required |
window_size | int | Length of the rolling window | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
SeasonalRollingMax
Bases: _SeasonalRollingBase
Seasonal rolling Maximum
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation | required |
season_length | int | Length of the seasonal period, e.g. 7 for weekly data | required |
window_size | int | Length of the rolling window | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
SeasonalRollingQuantile
_SeasonalRollingBase
Seasonal rolling statistic
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag | int | Number of periods to offset by before applying the transformation | required |
p | float | Quantile to compute | required |
season_length | int | Length of the seasonal period, e.g. 7 for weekly data | required |
window_size | int | Length of the rolling window | required |
min_samples | int | Minimum number of samples required to compute the statistic. If None, defaults to window_size. | None |
skipna | bool | If True, exclude NaN values from calculations. When False (default), NaN values propagate through the calculation. | False |
ExpandingMean
Bases: _ExpandingBase
Expanding Mean
Parameters:
ExpandingStd
Bases: _ExpandingBase
Expanding Standard Deviation
Parameters:
ExpandingMin
Bases: _ExpandingComp
Expanding Minimum
Parameters:
ExpandingMax
Bases: _ExpandingComp
Expanding Maximum
Parameters:
ExpandingQuantile
_BaseLagTransform
Expanding quantile
Parameters:
ExponentiallyWeightedMean
_BaseLagTransform
Exponentially weighted mean
Parameters:

