spei.utils module¶
Some utility functions for the SPEI package.
- 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:
series (pd.Series) – A pandas Series with a DateTime index.
- Return type:
pd.DataFrame
- spei.utils.infer_frequency(index: Index | DatetimeIndex) str¶
Infer frequency of DatetimeIndex.
- spei.utils.validate_index(index: Index) DatetimeIndex¶
Validate index to see if it is a DatetimeIndex and has no duplicates.
- spei.utils.validate_series(series: Series) Series¶
Validate series to see if it is a Series and has a DatetimeIndex.