monthly_average

hydrostats.data.monthly_average(merged_data)

Calculates monthly seasonal averages of the timeseries data in a DataFrame

Parameters:merged_data (DataFrame) – A pandas DataFrame with a datetime index and columns containing float type values.
Returns:A pandas dataframe with a string type index of date representations and the monthly seasonal averages as float values in the columns.
Return type:DataFrame

Examples

>>> import hydrostats.data as hd
>>> import pandas as pd
>>> pd.options.display.max_rows = 15

The data URLs contain streamflow data from two different models, and are provided from the Hydrostats Github page

>>> sfpt_url = r'https://github.com/waderoberts123/Hydrostats/raw/master/Sample_data/sfpt_data/magdalena-calamar_interim_data.csv'
>>> glofas_url = r'https://github.com/waderoberts123/Hydrostats/raw/master/Sample_data/GLOFAS_Data/magdalena-calamar_ECMWF_data.csv'
>>> merged_df = hd.merge_data(sfpt_url, glofas_url, column_names=('Streamflow Prediction Tool', 'GLOFAS'))
>>> hd.monthly_average(merged_df)
        Streamflow Prediction Tool        GLOFAS
01                 5450.558878   6085.033102
02                 4178.249788   4354.072332
03                 4874.788452   4716.785701
04                 7682.920219   7254.073875
05                13062.175899  11748.583189
06                12114.431105  11397.032335
07                 9461.472599   9598.017209
08                 8802.643954   8708.876388
09                10358.254219   9944.071882
10                12968.474415  12671.180449
11                13398.111010  13355.019167
12                 9853.288608  10275.652887