我试图通过分组变量来获取特定变量的描述性统计信息。我希望输出中的百分比值比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
答案 0 :(得分:1)
您应该做的-正确调用函数
df.groupby('a')['b'].describe(percentiles=[0.01,0.05,0.25,0.50,0.75,0.90,0.95,0.99])