Original Dataframe:
| A | B | C |
|---|---|---|
| 123 | 1500 | 0 |
Output:
| A | B | C |
|---|---|---|
| 123 | 1500 | 1.2 |
Logic needed: If column A contains 123, then for column C, take the value of B and multiply it with 0.0008, all the other values in column C should not be altered.
>Solution :
You could check if column "A" values are 123 or not and use mask on "C" to replace values there:
df['C'] = df['C'].mask(df['A']==123, df['B']*0.0008)
Output:
A B C
0 123 1500 1.2