My original DataFrame looks like this:
| windcodes | name | matu | CLAUSE | WEIGHTEDRT |
|---|---|---|---|---|
| 163197.SH | shangguo comp | 2.9248 | NO | 2.582 |
| 154563.SH | guosheng comp | 2.886 | YES | 2.773 |
| 789645.IB | guoyou comp | YES | 3.098 | |
| 1880260.IB | shagui comp | YES | 2.657 |
What I want to do now is that for every row if CLAUSE equal to yes, then substitute the matu value of that row with its WEIGHTEDRT value, and if CLAUSE equal to NO then just leave the original matu and weightedrt as they were.
I wish my outcome DataFrame to be look like this:
| windcodes | name | matu | CLAUSE | WEIGHTEDRT |
|---|---|---|---|---|
| 163197.SH | shangguo comp | 2.9248 | NO | 2.582 |
| 154563.SH | guosheng comp | 2.773 | YES | 2.773 |
| 789645.IB | guoyou comp | 3.098 | YES | 3.098 |
| 1880260.IB | shagui comp | 2.657 | YES | 2.657 |