Hi, I am trying to retrieve the rows with a minimum value of a column for each group. For example: the following dataframe:
a | b | c ---------- 1 | 1 | 1 1 | 2 | 2 1 | 3 | 3 2 | 1 | 4 2 | 2 | 5 2 | 3 | 6 3 | 1 | 7 3 | 2 | 8 3 | 3 | 9 ---------- I group by 'a', and want the rows with the smallest 'b', that is, I want to return the following dataframe: a | b | c ---------- 1 | 1 | 1 2 | 1 | 4 3 | 1 | 7 ---------- The dataframe I have is huge so get the minimum value of b from each group and joining on the original dataframe is very expensive. Is there a better way to do this? Thanks, Wei