Skip to content

Add grouped lag, rolling and expanding features - #1109

Open
lcrmorin wants to merge 2 commits into
feature-engine:mainfrom
lcrmorin:issue-668
Open

lcrmorin wants to merge 2 commits into
feature-engine:mainfrom
lcrmorin:issue-668

Conversation

@lcrmorin

@lcrmorin lcrmorin commented Oct 18, 2026 •

Copy link
Copy Markdown

Hello I was interested in having this in a personnal project. I used Gen AI to make this PR and reviewed it manually.


Closes #668. Adds groupby and sort_by to the existing forecasting transformers,
so stores/products/assets in the same dataframe cannot share lagged or aggregated
values. Multiple group columns form a combined key. Date-based results align on
both that key and timestamp. Existing ungrouped behaviour is unchanged.

This proposal follows the maintainer's invitation to supersede #727 with simpler
pandas grouped operations. It retains a unique row index; repeated dates across
groups can live in sort_by. No training history is carried into later transforms.
Per-variable window dictionaries are outside this change.

Validation: 143 forecasting tests pass on both pandas 3.0/sklearn 1.9 and pandas
2.2/sklearn 1.4, including independent-series reference comparisons, time windows,
frequency shifts, combined keys, drop_na and target alignment. User guides and
API docs updated; type and style checks pass.

Dependency requirements are unchanged. Testing covers the two configurations above, not the full supported-version matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New feature: Lag or windows features grouped by

1 participant