My df is as follows:
![enter image description here](https://i.stack.imgur.com/ff1Dp.png)
What I want to do is,
Condition: Fruit Name
is NOT (Apple or Mango
) and veggie Name
== No
Action: Set values in Veggie Color
and Enjoy Eating
= Unicorn
My code is
df.loc[(~df["Fruit Name"].isin(["Apple","Mango"]))& (df["Veggie Name"]=="Potato"),["Veggie Color","Enjoy Eating"]]="Unicorn"
While it does so as follows
![enter image description here](https://i.stack.imgur.com/eIOWg.png)
It sets NaN to other cells
![enter image description here](https://i.stack.imgur.com/1uBJa.png)
What am I missing?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…