I have the following dataset frame1
Color | Item |
---|---|
Red | Shirt |
White | Shoes |
Yellow | Shirt |
Green | Shoes |
I want to set all the colors for Shoes item to be "Blue", I use map
x = {"Shoes": "Blue"}
fr1["Color"] = fr1["Item"].map(x)
I expected the following result
Color | Item |
---|---|
Red | Shirt |
Blue | Shoes |
Yellow | Shirt |
Blue | Shoes |
Instead I got this
Color | Item |
---|---|
NaN | Shirt |
Blue | Shoes |
NaN | Shirt |
Blue | Shoes |