I am trying to create line chart for each data created by nested loop.
This is the first five rows of the main dataframe:
There are three unique countries in "Country" column. I want for each country to plot "hum","pre" and "temp" data separately. So there should be 9 charts (3x3).
This is my code:
fig,axes=plt.subplots(3,3,figsize=(15,15))
for country in df.Country.unique():
for i in ["pre","hum","temp"]:
for ax in axes.ravel():
grouped=df[(df.Country==country)&(df.year==2016)].groupby("date")[i].mean().reset_index().sort_values("date")
grouped.plot(ax=ax,kind="line",x="date",y=i,xlabel="")
ax.set_title(i+" for "+country,size=10)
plt.show()
