groupby的pandas数据帧上的峰度

2024-10-01 15:39:32 发布

您现在位置:Python中文网/ 问答频道 /正文

当Fames函数出现以下错误时,Kurtosi总是应用Fames函数:

AttributeError: Cannot access callable attribute 'kurt' of 'DataFrameGroupBy' objects, try using the 'apply' method

下面的示例代码适用于所有其他统计函数(mean()、skew(),…),但不适用于峰度。在

df = pd.DataFrame([[0,1,1,0,0,1],[0,1,2,4,5]]).T
df.columns = ['a','b']
df.groupby('a').kurt()

你知道在groupby之后如何应用峰度吗? 谢谢!在


Tags: of函数dfaccess错误attributeattributeerrorgroupby

热门问题