Given a dataframe condition
defined as:
0 [3, 4]
1 [2]
I want another dataframe’s 0th row, column 3 and 4 and 1th row, column 2 to be set to 0
For example given another dataframe df2
:
1 2 3 4
0 0.275464 0.275404 0.2782 0.273485
1 0.275464 0.275404 0.2782 0.273485
After applying condition
, I want df2
to become:
1 2 3 4
0 0.275464 0.275404 0.0000 0.0000
1 0.275464 0.000000 0.2782 0.273485
Is there a good way to do this without iterating over the individual rows?