Pandas : Assign result of groupby to dataframe to a new column,df.groupby('adult')['weight'].transform('idxmax')