使用matplotlib绘制直方图。

huangapple go评论58阅读模式
英文:

Plot the hist using matplotlib

问题

以下是数据框:

                数量      单价      客户ID
国家
荷兰        200128   6492.55    34190538.0
爱尔兰      142637   48447.19   110391745.0
德国        117448   37666.00   120075093.0
法国        110480   43031.99   107648864.0
澳大利亚     83653    4054.75    15693002.0

如何绘制条件直方图,其中x轴是国家(旋转90度),y轴是数量?

df.hist(x, y)

英文:

Below is the dataframe

             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

How to plot a histogram with condition x axis as country(rotate 90) and Quanity on Y axis

df.hist(x,y)

答案1

得分: 1

你可以尝试使用以下代码:

df.plot.bar(y='Quantity')

这是输出结果:
使用matplotlib绘制直方图。

英文:

You can try with this:

df.plot.bar(y='Quantity')

Here's the output:
使用matplotlib绘制直方图。

huangapple
  • 本文由 发表于 2020年1月3日 18:18:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/59576787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定