I have a DataFrame with columns similar to:
I want to use 'pd.groupby' to group rows according to ID column. Additionally, I want to use '.agg()' for applying functions to each column.
For the columns with scores, I want to apply 'np.average'. For example, for the column 'Reliability Score Flow A', the weights are in 'Flow A' column, for the column 'Reliability Score Flow B' in 'Flow B' and so on. On the other hand, for the columns with Flows, I only want to use sum.
So, the expected output would be something like:
How do you do it?
Thank you,