Skip to content

Commit 23d207c

Browse files
authored
fix(STEF-2802): skip RollingAggregatesAdder when no aggregation functions (#813)
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 <[email protected]>
1 parent 1bcf71d commit 23d207c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/openstef-models/src/openstef_models/presets/forecasting_workflow.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,16 @@ def create_forecasting_workflow(config: ForecastingWorkflowConfig) -> CustomFore
305305
DaylightFeatureAdder(
306306
coordinate=config.location.coordinate,
307307
),
308-
RollingAggregatesAdder(
309-
feature=config.target_column,
310-
aggregation_functions=config.rolling_aggregate_features,
311-
horizons=config.horizons,
308+
*(
309+
[
310+
RollingAggregatesAdder(
311+
feature=config.target_column,
312+
aggregation_functions=config.rolling_aggregate_features,
313+
horizons=config.horizons,
314+
),
315+
]
316+
if config.rolling_aggregate_features
317+
else []
312318
),
313319
]
314320
feature_standardizers = [

0 commit comments

Comments
 (0)