How to put the data of days into months and months into year

the above screenshot please tell me how I can combine the per day data into a single month and months data into a single year
the data I have if from 2014 to 2021
please tell me how I can do it I am totally new in this

thank you

Try,

df.groupby(df['date'].dt.strftime('%B'))['Close'].sum().sort_values()

This will give you combined data for each month but if you want month separate with individual data don’t use sum().

Instead, do

df.groupby(df['date'].dt.strftime('%B'))['Close'].sort_values()