我想用他们的均值替换体育场上座率的空值(法语中的富裕)。因此,我这样做是为了获得赛季/团队的平均值: test = data.groupby(['season','domicile']).agg({'affluence':'mean'}) 这段代码可以工作,并且给了我想要的(数据是dataframe): affluence
season domi
基于上一篇文章:Groupby and apply a specific function to certain columns and another function to the rest ofthe df Pandas 我想要对包含大量列的数据帧进行分组,但要应用一个函数(sum、mean等)。仅设置为两列,并获取其余列的第一个值。我该怎么做呢?在引用<e