相关疑难解决方法(0)

用python熊猫分箱列

我有一个数据框列与数字值:

df['percentage'].head()
46.5
44.2
100.0
42.12
Run Code Online (Sandbox Code Playgroud)

我希望将列视为bin计数:

bins = [0, 1, 5, 10, 25, 50, 100]
Run Code Online (Sandbox Code Playgroud)

如何将结果作为垃圾箱与他们一起获得value counts

[0, 1] bin amount
[1, 5] etc 
[5, 10] etc 
......
Run Code Online (Sandbox Code Playgroud)

python numpy dataframe pandas

69
推荐指数
2
解决办法
7万
查看次数

如何按python pandas中的值范围列表进行分组

我有以下数据框

name,value
a,100
b,200
c,150
d,300
e,400
f,200
g,100
Run Code Online (Sandbox Code Playgroud)

我有范围列表,例如 [0-100,100-200,超过 200]

基于此,我必须计算上面数据框中的记录数。

我需要像这样的输出

category,count
0-100,2
100-200,3
mor than 200,3
Run Code Online (Sandbox Code Playgroud)

python pandas

2
推荐指数
1
解决办法
7714
查看次数

标签 统计

pandas ×2

python ×2

dataframe ×1

numpy ×1