I have the following df:
| ICB | sICB |
|---|---|
| A | B1 |
| ZB1 | ZC1 |
| ZB1 | ZC2 |
| ZB1 | ZC3 |
For each row, I want to replace ZB1 with the value in the column sICB.
All other related answers on SO are referring to "some other value" as part of a condition. But I need to replace any occurrence of ZB1 with whatever is in the sICB column. There must be a simple way to do it, but I can't come up with it.
I've tried with df[loc] with DataFrame.replace(), mask, where.
What intuitively seems correct is:
df.where([df['ICB'].eq('ZB1'), df[sICB])