preprocessing.imputation.get_missing_weights

preprocessing.imputation.get_missing_weights(
    data,
    window_size=72,
    verbose=False,
)

Return imputed DataFrame and a series indicating missing weights.

Parameters

Name Type Description Default
data pd.DataFrame The input dataset. required
window_size int The size of the rolling window to consider for missing values. 72
verbose bool Whether to print additional information. Defaults to False. False

Returns

Name Type Description
tuple[pd.DataFrame, pd.Series] Tuple[pd.DataFrame, pd.Series]: A tuple containing the forward and backward filled DataFrame and a numeric series (0.0 or 1.0) where 0.0 indicates a weight for missing values/gaps.

Examples

>>> from spotforecast2_safe.data.fetch_data import fetch_data
>>> from spotforecast2_safe.preprocessing.imputation import get_missing_weights
>>> data = fetch_data()
>>> filled_data, missing_weights = get_missing_weights(data, window_size=72, verbose=True)