I want to create a new variable in the dataframe with the color category depending on the color chosen by each employee, so I want to get something like this result:
employee salary color category
1 John Doe 21000 blue cold
2 Peter Gynn 23400 green cold
3 Jolie Hope 26800 red warm
Of course, this example uses very simple data, but I have to solve this problem with a much larger dataframe and a 220 codes list organized in categories to classify the dataframe observations...
You can just change the columns to be whatever it is you want so you can change the numeric to say your colours and then have the cold or warm associated with it and then simply do a join which will perform it for all your cases and you only have to pass that initial lookups. Let me know if this helps?