Dhruv Nautiyal
Dhruv Nautiyal

Reputation: 129

Ploting a Histogram

I need to plot a histogram for the data below, country wise quantity sum.

     Country         Quantity
0   United Kingdom   4263829
1   Netherlands      200128
2   EIRE             142637
3   Germany          117448
4   France           110480
5   Australia        83653
6   Sweden           35637
7   Switzerland      30325
8   Spain            26824
9   Japan            25218

so far i have tried this but unable to specify the axis myself:

df.plot(x='Country', y='Quantity', kind='hist', bins=10)

enter image description here

Upvotes: 0

Views: 85

Answers (2)

baby_yoda
baby_yoda

Reputation: 103

Try this :

import matplotlib.pyplot as plt
plt.bar(df['Country'],df['Quantity'])
plt.show()

Upvotes: 1

Colas
Colas

Reputation: 2076

Try a bar plot instead of a plot:

df.bar(x='Country', y='Quantity')

Upvotes: 2

Related Questions