FAQ Database Discussion Community

Python Pandas: Spread total values in dataframe based on percentages back to categories

I have the below dataframe and I would like to spread the total values in the val columns back to the Cat column based on the percentages in the Percentage column. Country State City Cat Total amount Percentage val1 val2 val3 val4 US FL MIA cat1 100 10 US FL...