in case feature encoding, if I'd like to encode my values based on my pre-determined dictionary, how do I do that?
For instance, say, I've values as [Red, Green, and Blue]
and I want to encode them as [-1,0,1]
-1 for red, 0 for Green, 1 for Blue... I'll apply it to my feature. I believe I can do it by mapping, apply method, not sure. But is there any better way to do that?
Column expectedEncoding
Red -1
Red -1
Blue 1
Green 0
Red -1
Blue 1
```
df[col].map(mapping)
wherecol
is the name of the column to be encoded andmapping
is a dictionary with the values $\endgroup$