I have an array like this:
name foo bar
A 0 [3, 1]
A 2 [2, 3] *
B 3 [1, 0]
B 9 [0, 1] *
B 1 [1, 0]
I would like to keep, for each unique name
, the row that hax the maximum bar[1]
value (marked with a *
above), so that the result should be
name foo bar
A 2 [2, 3]
B 9 [0, 1]
There is this question and the related answer that is very closely related to my problem, however in that question, the max
is done directly on the columns value. If GroupBy.max
accepted a key
function like the built-in max
then this would be a no-brainer -- however this is not the case.