Python:在条形图中显示列中的值数
在下面的数据框中,每列具有“相等”值。我需要一个条形图,该图显示了其中有多少个相对于列的值。 X平面上的列名和Y平面上的“相等”的总数。不幸的是,我无法显示它,因为我无法打印它。谢谢。
result_invoiceNo result_totalGross ... result_totalNet result_invoiceDate
0 equal equal ... equal equal
1 ...
2 equal equal ... equal equal
3 ...
4 equal equal ... equal equal
.. ... ... ... ... ...
183 ... not equal
184 equal equal ... equal equal
185 ...
186 equal equal ... equal equal
In the dataframe below, each column has an "equal" value. I need a bar graph that shows how many of these values are relative to the columns. Column names on the x plane and the total number of "equal" on the y plane. Unfortunately, I can't show it because I can't print it. thanks.
result_invoiceNo result_totalGross ... result_totalNet result_invoiceDate
0 equal equal ... equal equal
1 ...
2 equal equal ... equal equal
3 ...
4 equal equal ... equal equal
.. ... ... ... ... ...
183 ... not equal
184 equal equal ... equal equal
185 ...
186 equal equal ... equal equal
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CSV **,
如果所有数据帧的所有列都包含在“相等”或“不相等”的数据中,那么我已经解决了您的上述问题并找到了解决方案。那是下面的。
head()默认情况下返回DataFrame的前五个元素。
<
pd_dt
现在,计数来自dt_frame的每一列中的值,并将计数放入pd_dt列中。
最终pd_dt
现在,绘制 bar 图,PANDA提供了绘制数据框架的绘图函数。
输出
态
csv**,
I have gone through your above question and got the solution for it, if all the columns of dataframe is contains with 'equal' or 'not equal' data. that is below.
head() returns the top five elements from DataFrame by default.
Top 5 records of dt_frame
Convert your dataframe into below as well as.
pd_dt
Now count the values from every column of dt_frame and put the count in pd_dt columns.
final pd_dt
Now, plot the bar graph, pandas provides the plot function to plot the dataframe.
Output
bar graph of dataframe