How would you go about grouping a DataFrame based on one column, checking which is the highest value on another column within each group (or any other condition), and creating a new DataFrame with the rows of all values found during the grouping?
If I use groupby on the column of interest to then check the condition I want, the only thing I'll get back is a df with two columns, but I want to all columns of the original df.
Code:
df_best = df.groupby('Type 1')['Total'].max()
I know why my code above doesn't work in this case, but I can't figure out a way to get what I want...
Thanks in advance!