Bar chart using dataframe Matplotlib
If your dataframe's index has a name, pandas will distinguish it visually by printing it on a line below the column names. In this case Cluster
is the name of your index.
The simplest solution is to leave x
alone: it will default to the index if you don't supply a column name:
data_agg_clust.plot.bar(y="KPIPred", rot=70, title="Predicted Volume of impressions")
Another solution is to call data_agg_clust.reset_index
to convert the index into a column that can be used for plotting:
data_agg_clust.reset_index().plot.bar(x="Cluster", y="KPIPred", rot=70, title="Predicted Volume of impressions")