Volatil3
Volatil3

Reputation: 14978

Pandas: How to label groupby data in plot?

I am trying to plot a graph of the following data: enter image description here

When I use df.groupby('Item').sum().plot() it results:

enter image description here

First, it does not seem to show all 107 records, 2nd, I don't know how to label Item names on X-axis. Any pointer pls?

Upvotes: 0

Views: 275

Answers (1)

user3483203
user3483203

Reputation: 51155

Don't use a line chart here, use a bar chart, as there is no linear correlation between any of your items. This will solve your labeling problem at the same time:

df.groupby('Item').sum().plot(kind='bar')
plt.tight_layout()
plt.show()

enter image description here

Upvotes: 2

Related Questions