![](/img/trans.png)
[英]Plot histogram with index values on x axis and frequencies of each column value on y axis
[英]How to create a histogram for a dataframe with just 1 column and multiple rows (row values should be plot on x axis and column values on y axis)
我正在寻找为以下数据框绘制直方图(见下文)
| missing_values
---------------
F1 | 123
F2 | 80
F3 | 0
.
.
F84| 20
值在 x 轴上表示为 F1,F2,F3....F84 和在 y 轴上表示 missing_Values 注意:如您所见,没有与 F1,F2...F84 关联的列名
有人可以建议如何为此创建直方图吗? 在绘制直方图之前是否需要进行任何操作。 我无法弄清楚需要什么
你可以试试:
import matplotlib.pyplot as plt
plt.bar(x=df.index.values, height=df.missing_values.values)
如果您需要转换普通列中的索引,您可以使用df.reset_index(inplace=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.