From 955dc66a34e78cafd99492749cf54a71e3b8c6f6 Mon Sep 17 00:00:00 2001 From: Egor Dmitriev Date: Fri, 20 Feb 2026 10:10:18 +0100 Subject: [PATCH] fix(STEF-2802): skip RollingAggregatesAdder when no aggregation functions When rolling_aggregate_features is empty (e.g., ato_regions, grid_losses), the RollingAggregatesAdder transform is no longer added to the pipeline. Previously it was always added, and fit() would crash with ValueError: No objects to concatenate when calling pandas rolling().agg([]). Signed-off-by: Egor Dmitriev --- .../presets/forecasting_workflow.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/openstef-models/src/openstef_models/presets/forecasting_workflow.py b/packages/openstef-models/src/openstef_models/presets/forecasting_workflow.py index bb0221b54..df013b529 100644 --- a/packages/openstef-models/src/openstef_models/presets/forecasting_workflow.py +++ b/packages/openstef-models/src/openstef_models/presets/forecasting_workflow.py @@ -305,10 +305,16 @@ def create_forecasting_workflow(config: ForecastingWorkflowConfig) -> CustomFore DaylightFeatureAdder( coordinate=config.location.coordinate, ), - RollingAggregatesAdder( - feature=config.target_column, - aggregation_functions=config.rolling_aggregate_features, - horizons=config.horizons, + *( + [ + RollingAggregatesAdder( + feature=config.target_column, + aggregation_functions=config.rolling_aggregate_features, + horizons=config.horizons, + ), + ] + if config.rolling_aggregate_features + else [] ), ] feature_standardizers = [