How can I merge/combine two rows with the same ids (row 1 and 2) and average out columns A and B. So that my dataframe would go from this:
id A B
0 22 25 3
1 23 24 5 <-
2 23 56 3 <-
3 24 34 6
to this:
id A B
0 22 25 3
1 23 40 4 <- averages of the two rows for A and B
2 24 34 6
Basically two rows are collapsed into one. The data in column A is averaged with column A, and column B is averaged with column B.