Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图通过分组变量获取特定变量的描述性统计信息。我希望输出中的百分位值比 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
describe() takes 1 positional argument but 2 were given
你应该做什么——正确调用函数
df.groupby('a')['b'].describe(percentiles=[0.01,0.05,0.25,0.50,0.75,0.90,0.95,0.99])