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