I have the following dataframe:
col_a, col_b, col_c
1 01 34
1 02 23
1 03 567
1 04 425
2 01 234
2 02 54
2 03 56
3 01 56
3 02 567
I want to select the rows with the max value in col_b
for each col_a
value. I have tried this:
df[["col_a", "col_b", "col_c"]].groupby(["col_a", "col_b"]).max("col_b")
But I just get all values for “col_b”.
How can achieve my goal?