Python 使用matplotlib打印历史记录

Python 使用matplotlib打印历史记录,python,matplotlib,Python,Matplotlib,下面是数据帧 Quantity UnitPrice CustomerID Country Netherlands 200128 6492.55 34190538.0 EIRE 142637 48447.19 110391745.0 Germany 117448 37666.00 120075093.0 France 110480 43031.99

下面是数据帧

             Quantity   UnitPrice   CustomerID
Country         
Netherlands  200128     6492.55     34190538.0
EIRE         142637     48447.19    110391745.0
Germany      117448     37666.00    120075093.0
France       110480     43031.99    107648864.0
Australia    83653      4054.75     15693002.0
如何绘制直方图,条件x轴为国家(旋转90),数量为Y轴

df.hist(x,y)
您可以尝试以下方法:

df.plot.bar(y='Quantity')
以下是输出:

那么为什么我们不需要给出x轴呢?因为默认情况下它被设置为数据帧的
索引。您可以更明确地这样做:
df.plot.bar(y='Quantity',使用_index=True)