国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

python - pandas groups by column A and column B, and averages column C. How to generate a dataframe of columns A, B, and C?
怪我咯
怪我咯 2017-05-24 11:35:08
0
2
891
df = df.groupby(['A','B'])['c'].mean()

In this way, df is grouped, but how to turn df into a dataframe with columns A, B, and C?
Thanks

怪我咯
怪我咯

走同樣的路,發(fā)現(xiàn)不同的人生

reply all(2)
為情所困

I asked this question on stackoverflow, and some netizens gave me the answer. In fact, you only need to add one parameter. The method is as follows:

df = df.groupby(['A','B'],as_index = False)['C'].mean()
習(xí)慣沉默

At least one reassignment is needed to extract these three columns. The grouping method seems to be like yours

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template