Prateek Narendra
Prateek Narendra

Reputation: 1937

How to Plot a Bar Graph in Pandas for frequency Count?

I have a table -

   ProductCD    Frequency
0     C           62192
1     R           37548
2     H           32908
3     S           11585

How do I plot a bar graph to show Frequency of ProductCD ?

Upvotes: 0

Views: 127

Answers (2)

BENY
BENY

Reputation: 323226

You can just do

df.set_index('ProductCD')['Frequency'].plot(kind='bar')

Upvotes: 1

Prateek Narendra
Prateek Narendra

Reputation: 1937

df.plot.bar(x = 'ProductCD', y = 'Frequency', rot = 0)

Upvotes: 0

Related Questions