I would like to combine groupby and min but keep the entire dataframe. If I use the below approach I end up with only the 2 columns, the col1 and col2:
For this df:
col1 col2 col3
1 1 'A'
1 0 'B'
2 2 'C'
2 3 'D'
df.groupby(df['col1'])[['col2']].min():
col1 col2
1 0
2 2
But instead once the min row of col2 is identified, I want the corresponding elements of that row from col3, so this:
col1 col2 col3
1 0 'B'
2 2 'C'