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
  • 443,496
  • 30
  • 428
  • 555
Chunk_Ning
  • 113
  • 2
  • 8

0 Answers0