I have a dataset like this
A B Group Index
1 3 G1 25
1 3 G1 23
1 3 G1 99
4 5 G2 6
4 5 G2 8
4 5 G2 10
4 5 G2 2
4 5 G2 4
Ideal output is to pick top x rows for each group with a descending order for Index
Group Index
G1 23
G2 6
G2 8
G2 2
G2 4
- For each distinct value in
Group
, values ofA
andB
are identical for all rows. B
indicates how many rows in the dataset. E.g. we have 3 rows for G1.A
indicates how many rows needed for output. E.g. in the output only one row with lowest value ofIndex
exists for G1 and 4 rows for G2
Can anyone shed some light on how to deal with this?