preprocessing.imputation.custom_weights

preprocessing.imputation.custom_weights(index, weights_series)

Return 0 if index is in or near any gap.

Parameters

Name Type Description Default
index pd.Index The index to check. required
weights_series pd.Series Series containing weights. required

Returns

Name Type Description
float float The weight corresponding to the index.

Examples

>>> from spotforecast2_safe.data.fetch_data import fetch_data
>>> from spotforecast2_safe.preprocessing.imputation import custom_weights
>>> data = fetch_data()
>>> _, missing_weights = get_missing_weights(data, window_size=72, verbose=False)
>>> for idx in data.index[:5]:
...     weight = custom_weights(idx, missing_weights)
...     print(f"Index: {idx}, Weight: {weight}")