I have a data frame that look like this
Col1 Col2
0 22 Apple
1 43 Carrot
2 54 Orange
3 74 Spinach
4 14 Cucumber
And I need to add new column with the category "Fruit" , "Vegetable" or "Leaf" I created a list for each category
Fru = {'Apple','Orange', 'Grape', 'Blueberry', 'Strawberry'}
Veg = {'Cucumber','Carrot','Broccoli', 'Onion'}
Leaf = {'Lettuce', 'Kale', 'Spinach'}
And the result should look like this
Col1 Col2 Category
0 22 Apple Fruit
1 43 Carrot Vegetable
2 54 Orange Fruit
3 74 Spinach Leaf
4 14 Cucumber Vegetable
I tried np.where and contains yet both functions give: 'in ' requires string as left operand, not set