index type.x type.y col3 col4
1 a m 20 25
2 b m 30 28
3 a m 15 555
3 a n 20 555
4 a m 666 10
4 b m 666 20
I have tried aggregate keeping the index and group_by without success when I try to get this shape:
index col3 col4
1 20 25
2 30 28
3 35 555
4 666 30