spei.utils module

spei.utils.daily_window_group_yearly_df(dfval: DataFrame, period: int) → DataFrame

Fill a period of daily values in grouped by yearly DataFrame to get cyclic rolling window.

spei.utils.get_data_series(group_df: DataFrame) → Series

Transform grouped dataframe by yearly values back to time series.

spei.utils.group_yearly_df(series: Series) → DataFrame

Group Series per year in a DataFrame.

This function groups a time series by year, creating a DataFrame where each column corresponds to a year (as int). The index of the DataFrame is set to the corresponding dates (in the year 2000).

Parameters:

seriespd.Series

A pandas Series with a DateTime index.

Returns:

pd.DataFrame

spei.utils.infer_frequency(index: Index | DatetimeIndex) → str

Infer frequency

spei.utils.validate_index(index: Index) → DatetimeIndex
spei.utils.validate_series(series: Series) → Series