计数,条形,每个熊猫数据框直方图子图
我每小时要进行单独的旅行距离直方图。但是,为了进一步计算,我想为所有直方图中的每个直方图中的每个垃圾箱的值。
到目前为止,我有以下内容:
df['Distance'].hist(by=df['Departuretime'], color = 'red',
edgecolor = 'black',figsize=(15,15),sharex=True,density=True)
在我的情况下,这是一个具有21个小直方图的数字。
在单个直方图的情况下,我会粘贴计数,垃圾箱,bars =
在整个行的前面,变量counts
将包含我正在寻找的数据,但是,这种情况不起作用。
理想情况下,我想要每个直方图的数据框架或某种形式的列表,其中包含箱的密度值。我希望有人可以帮助我!提前致谢!
编辑:
我正在使用的数据,大约2500列,距离为float64,dewdurationeption s str str
我想知道y轴的所有这些直方图中的直方图 每个条的值,最好是在距离式包装的数据框架中,作为行,小时为列
I am making separate histograms of travel distance per departure hour. However, for making further calculations I'd like to have the value of each bin in a histogram, for all histograms.
Up until now, I have the following:
df['Distance'].hist(by=df['Departuretime'], color = 'red',
edgecolor = 'black',figsize=(15,15),sharex=True,density=True)
This creates in my case a figure with 21 small histograms.
With single histograms, I'd paste counts, bins, bars =
in front of the entire line and the variable counts
would contain the data I was looking for, however, in this case it does not work.
Ideally I'd like a dataframe or list of some sort for each histogram, containing the density values of the bins. I hope someone can help me out! Thanks in advance!
Edit:
Data I'm using, about 2500 columns of this, Distance is float64, the Departuretime is str
Histogram output I'm receiving
Of all these histograms I want to know the y-axis value of each bar, preferably in a dataframe with the distance binning as rows and the hours as columns
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用“剪切”函数,您可以直接从数据框架而不是从图形中提取所请求的数据。这对误差敏感性较小。
然后,您可以使用pivot_table来获取一个表格,并分别按照您的要求,分别将decortbin和dectionbin时的计数作为行和列。
By using the 'cut' function you can withdraw the requested data directly from your dataframe, instead of from the graph. This is less error-sensitive.
Then, you can use pivot_table to obtain a table with the counts for each combination of DistanceBin and Departuretime as rows and columns respectively as you asked.