'Percentages over column total avoiding warning

I am trying to get a new column with percentages over the total of another column without the warning regarding the copy/slice problem,

So "data" table is in place, so I want to add a new column "%" which is the percentage of m€ over total m€...

data_assets["%"] = data_assets["m€"]/data_assets["m€"].sum()

data table

It looks like it's working but would like the workaround for the warning.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source