Looking to use multiple columns for creating a new column while using a dictionary to create the new columns values. Simple example below:
df:
Col1 Col2 Col3
Dog Bird Cat
Blue Red Black
Bad Sad Glad
my_dict = {'Bird': 'AAA','Blue':'BBB','Glad':'ZZZ'}
desired df:
Col1 Col2 Col3 NewCol
Dog Bird Cat AAA
Blue Red Black BBB
Bad Sad Glad ZZZ
I've played around with the map function (df.NewCol = df.Col.map(my_dict))... but it only allows me to use one column to search for the keys in my dictionary. I need the Col1, Col2, AND Col3 columns to search through my dictionary in order to create NewCol.
Any ideas? thanks!