Bar Graph
Solution
df = df.groupby("date").mean().reset_index()
df
We plot bar graphs using seaborn’s factorplot function. By giving an x, y, data and kind (in our case we give bar) we will be able to plot a graph.
sns.factorplot(x="date", y="GDP Rate",data=df,kind="bar")
plt.show()
One correction to make to this is to set up the x label ticks to be spaced out by 8 which we can do by first setting the plot equal to a variable then calling set_xticklabels() with the argument steps=n where n is how many steps we want in between.
graph = sns.factorplot(x="date", y="GDP Rate",data=df.groupby("date").mean().reset_index(),kind="bar")
graph.set_xticklabels(step=8)
plt.show()
Source Code