3

我试图通过分组变量获取特定变量的描述性统计信息。我希望输出中的百分位值比 describe 函数默认提供的更多。

我尝试了以下代码:

df.groupby('city')['population'].describe([0.01,0.05,0.25,0.50,0.75,0.90,0.95,0.99])

它给出了一个错误: describe() takes 1 positional argument but 2 were given

4

1 回答 1

1

你应该做什么——正确调用函数

df.groupby('a')['b'].describe(percentiles=[0.01,0.05,0.25,0.50,0.75,0.90,0.95,0.99])
于 2019-04-25T13:41:48.287 回答