[英]How to plot CDF or histogram using a given bins and frequency values? Python
I have a histogram data with two values. 我有一个有两个值的直方图数据。 The number of sessions binned (buckets) at every 100ms.
每100毫秒合并(桶)的会话数。 The following dataframe is sample data for reproducibility.
以下数据框是用于重现性的示例数据。 How can I generate a Histogram or CDF out of this kind of data df ?
如何从此类数据df中生成直方图或CDF? I appreciate any help or hint.
我感谢任何帮助或提示。
import pandas as pd
no_of_session = [8228, 6269,4955,4955,3761,3627]
buckets = [3.0, 2.0, 3.1, 4.0, 3.3 ]
# create empty data frame in pandas
df = pd.DataFrame()
# add a coumn
df['no_of_session'] = no_of_session
df['buckets'] = buckets
Jack's answer does not take into account "buckets". 杰克的答案没有考虑“桶”。
By the title of your question, you wish to plot a histogram for already given bins with counts. 根据您的问题的标题,您希望绘制已经给定的带有计数的箱的直方图。 In this case, see eg related question and answer:
在这种情况下,请参阅例如相关的问题和答案:
Plotting a histogram given bin endpoints and values 绘制给定bin端点和值的直方图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.