我有一个数据帧,我在上面使用了.groupby()和.agg()函数。你知道吗
movieProperties = combined_df.groupby(['movieId', 'title', 'genres']).agg({'rating': ['count', 'mean']})
这是创建新数据帧的代码。然而,我似乎不能访问列相同的方式了。如果我尝试movieProperties['genres']
,我总是会得到一个KeyError。如何在此新数据框中再次访问列?你知道吗
Tags:
groupby之后,按其分组的列现在称为
index
:如果您对此不满意,请将它们重置为常规列:
然后呢
相关问题 更多 >
编程相关推荐