I have a column of product names and I want to extract brand names for the same from my list.
my_list=['Lakme','Olay','Estee Lauder']
The column df['product_name']
has product names like 'Lakme Absolute Blur Perfect Makeup Primer'
.
I want to create a new column df['brand']
if the brand name lies in the string from my_list
.
I tried
df['brand']=df['product_name'].apply(lambda x: True if any(s in x for s in my_list) else False)
This just gives True/False. How do I extract brand in one step?