preprocessing.curate_data.curate_holidays(holiday_df, data, forecast_horizon)
Checks if the holiday dataframe has the correct shape. Args: holiday_df (pd.DataFrame): DataFrame containing holiday information. data (pd.DataFrame): The main dataset. forecast_horizon (int): The forecast horizon in hours.
Examples
import pandas as pd
from spotforecast2_safe.preprocessing.curate_data import curate_holidays
FORECAST_HORIZON = 24
n_data = 48
data = pd.DataFrame(
{"load" : range (n_data)},
index= pd.date_range("2023-01-01" , periods= n_data, freq= "h" , tz= "UTC" ),
)
holiday_df = pd.DataFrame(
{"holiday" : range (n_data + FORECAST_HORIZON)},
index= pd.date_range(
"2023-01-01" , periods= n_data + FORECAST_HORIZON, freq= "h" , tz= "UTC"
),
)
curate_holidays(holiday_df, data, forecast_horizon= FORECAST_HORIZON)
assert holiday_df.shape[0 ] == data.shape[0 ] + FORECAST_HORIZON
print ("holiday_df shape is correct:" , holiday_df.shape[0 ] == data.shape[0 ] + FORECAST_HORIZON)
holiday_df shape is correct: True
Raises
AssertionError
If the holiday dataframe does not have the correct number of rows.