Below is my dataframe

This is my dataframe

I want to calculate the climatological monthly average, the total average for each month.

For example, when I use groupby to estimate the monthly average of the variable AREA as below

annual_average = df.groupby(by=[pd.Grouper(key='TIME', freq='M')])['AREA'].mean().reset_index()

it gives me this below (weekly average for each month for each year):

Weekly average for each month

I want to calculate the average for each month but over the years from 1981 to 2018

Many thanks



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.