1

For example, there is a DataFrame named df. And I group it by column 'A' and column 'B',then get the mean value of column 'C'. I use the following code:

df = df.groupby(['A','B'])['C'].mean()
df = df.to_frame()

But finally I want to get a new DataFrame with 3 columns('A','B','C').How can I do after these code?

Willem Van Onsem
  • 397,926
  • 29
  • 362
  • 485
Chunk_Ning
  • 103
  • 2
  • 7

0 Answers0