[英]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)
I am looking to plot histogram for the following dataframe (see below)我正在寻找为以下数据框绘制直方图(见下文)
| missing_values
---------------
F1 | 123
F2 | 80
F3 | 0
.
.
F84| 20
with values represented as F1,F2,F3....F84 on x axis AND missing_Values represented on y axis Note: There is no column name associated to F1,F2...F84 as you see值在 x 轴上表示为 F1,F2,F3....F84 和在 y 轴上表示 missing_Values 注意:如您所见,没有与 F1,F2...F84 关联的列名
Could someone advise on how to create a histogram for this?有人可以建议如何为此创建直方图吗? IS there any manipulation i need to do before i can plot histogram.在绘制直方图之前是否需要进行任何操作。 I am not able to figure out what is needed我无法弄清楚需要什么
You can try:你可以试试:
import matplotlib.pyplot as plt
plt.bar(x=df.index.values, height=df.missing_values.values)
If you ever need to transform the index in a ordinary column, you can use df.reset_index(inplace=True)
如果您需要转换普通列中的索引,您可以使用df.reset_index(inplace=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.