Pandas Groupby apply Function on each Group Item

Here we are trying to write a solution for Group by COULUMN_2 Sum the COULUMN_1 values in each group and divide each COULUMN_1 values by Sum of it's group total. # using transform function df_new = df[['COULUMN_1','COULUMN_2']] grp = df_new.groupby('COULUMN_2') sc = lambda x: (x) / x.sum() # sum the COULUMN_1 values in each group … Continue reading Pandas Groupby apply Function on each Group Item