I want to divide all values in certain columns matching a regex expression by some value and still have the complete dataframe.
As can be found here: How to select columns from dataframe by regex , e.g. all columns starting with d can be selected with:
df.filter(regex=("d.*"))
Now I have the columns selected I need, I want e.g. divide the values by 2. Which is possible with the following code:
df.filter(regex=("d.*")).divide(2)
However if I try to update my dataframe like this, it gives a can't assign to function call:
df.filter(regex=("d.*")) = df.filter(regex=("d.*")).divide(2)
How to properly update my existing df?