相关疑难解决方法(0)

更改value_counts中的排序

如果我做

mt = mobile.PattLen.value_counts()   # sort True by default
Run Code Online (Sandbox Code Playgroud)

我明白了

4    2831
3    2555 
5    1561
[...]
Run Code Online (Sandbox Code Playgroud)

如果我做

mt = mobile.PattLen.value_counts(sort=False) 
Run Code Online (Sandbox Code Playgroud)

我明白了

8    225
9    120
2   1234 
[...]
Run Code Online (Sandbox Code Playgroud)

我想要做的是以2,3,4的升序(左数字列)获得输出.我可以以某种方式更改value_counts还是需要使用其他函数.

python dataframe pandas

29
推荐指数
2
解决办法
3万
查看次数

标签 统计

dataframe ×1

pandas ×1

python ×1