我需要为以下数据绘制直方图,按国家/地区计算数量之和。
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
到目前为止,我已经尝试过了,但是我自己无法指定轴:
df.plot(x='Country', y='Quantity', kind='hist', bins=10)
尝试用bar plot代替绘图:
df.bar(x='Country', y='Quantity')
尝试一下:
import matplotlib.pyplot as plt
plt.bar(df['Country'],df['Quantity'])
plt.show()