HolidayFeatureAdder#

class openstef_models.transforms.time_domain.holiday_features_adder.HolidayFeatureAdder(**data: Any) None[source]

Bases: BaseConfig, TimeSeriesTransform

Transform that adds holiday features to time series data.

Computes features that indicate whether a date is a holiday based on the specified country and categories.

The features added are:

  • is_holiday: 1 if the day is a public holiday, 0 otherwise.

  • is_{holiday_name}: 1 if the day is a specific holiday, 0 otherwise.

Example

>>> import pandas as pd
>>> from datetime import timedelta
>>> from openstef_core.datasets import TimeSeriesDataset
>>> from openstef_models.transforms.time_domain import (
...     HolidayFeatureAdder
... )
>>>
>>> # Create sample dataset
>>> data = pd.DataFrame({
...     'load': [100] * 5
... }, index=pd.date_range('2025-12-24', periods=5, freq='D'))
>>> dataset = TimeSeriesDataset(data, sample_interval=timedelta(days=1))
>>> transform = HolidayFeatureAdder(country_code='NL')
>>> transformed_data = transform.transform(dataset).data
>>> transformed_data["is_holiday"].tolist()
[0, 1, 1, 0, 0]
>>> transformed_data["is_christmas_day"].tolist()
[0, 1, 0, 0, 0]
>>> transformed_data["is_second_day_of_christmas"].tolist()
[0, 0, 1, 0, 0]
Parameters:

data (Any)

country_code: CountryAlpha2
reserved_datetime_features: frozenset[str]
transform(data: TimeSeriesDataset) TimeSeriesDataset[source]

Transform the dataset by adding holiday features.

Parameters:
Returns:

Transformed dataset with holiday features added.

Return type:

TimeSeriesDataset

features_added() list[str][source]

List of feature names added by this transform.

Return type:

list[str]

Returns:

A list of strings representing the names of features added to the dataset by this transform. Default is an empty list.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].