I have a dataframe that looks like:
body label
the sky is blue [noun]
the apple is red. [noun]
Let's take a walk [verb]
I want to add an item to the list in label depending on if there is a color in the body column.
Desired Output:
body label
the sky is blue [noun, color]
the apple is red. [noun, color]
Let's take a walk [verb]
I have tried:
data.loc[data.body.str.contains("red|blue"), 'label'] = data.label.str.append('color')