Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-如何在使用pandas.plot.hist()时存储浮点数_Python_Pandas_Matplotlib_Data Science_Histogram - Fatal编程技术网

Python-如何在使用pandas.plot.hist()时存储浮点数

Python-如何在使用pandas.plot.hist()时存储浮点数,python,pandas,matplotlib,data-science,histogram,Python,Pandas,Matplotlib,Data Science,Histogram,我正在使用Pandas并尝试创建一个浮动数字频率的直方图(在箱子中) 我不需要将这些设置为任何特殊的值,只需要得到一个合理的直方图,以合理的方式显示数据点的频率 正在尝试使用此代码 vals, bins = np.histogram(total["ratio"].tolist(), bins=10) total[["ratio"]].plot().hist(x="ratio", bins=bins) 我还尝试使用10作为bin的参数。

我正在使用Pandas并尝试创建一个浮动数字频率的直方图(在箱子中)

我不需要将这些设置为任何特殊的值,只需要得到一个合理的直方图,以合理的方式显示数据点的频率

正在尝试使用此代码

vals, bins = np.histogram(total["ratio"].tolist(), bins=10)
total[["ratio"]].plot().hist(x="ratio", bins=bins)
我还尝试使用10作为bin的参数。得到了同样的结果

采取

但仍然没有将轴装箱,这会造成很大的混乱。 为了存储数据,我在这里遗漏了什么

更新

使用
df[“ratio”].hist()
非常有效。
通过
df[[“ratio”]].plot().hist()
执行实际相同操作不起作用的原因是什么?

对于这些数据
total[[“ratio”]]].plot()
创建了一个混乱的线图。无论你在命令后添加什么,都不会让它变得不那么混乱。另外请注意,如果您使用的是
df[“ratio”].hist()
,您不需要
np.histogram()
。来回答更新中的问题:您不需要
之后的
()
。所以,你们要么想要
df[[“ratio”]].plot.hist()
要么想要
df[[“ratio”]].hist()
,而不是
df[[“ratio”]].plot().hist()
,你们两个能不能发布一个答案让我接受?