I have the following dataframe:
X Y Z A B
1 7.9 0.2 0.6 0.3 0.75
2 8.9 0.2 0.1 0.8 0.60
3 8.9 0.2 0.9 0.0 0.45
4 4.3 0.3 2.3 0.3 0.35
5 7.8 0.3 2.0 0.6 0.36
6 8.9 0.3 1.3 0.4 0.34
7 1.2 3.4 4.0 3.0 3.50
8 7.8 9.0 0.0 9.0 9.50
The dataframe is grouped using the 'Y' column. In each group, I would like to get the average value for 'X' and max for 'Z', 'A', and 'B'.
The result should look like this:
X Y Z A B
0 8.56 0.2 0.9 0.8 0.75
1 7.00 0.3 2.3 0.6 0.36
2 1.20 3.4 4.0 3.0 3.50
3 7.80 9.0 0.0 9.0 9.50