Say I have a list BRANDS that contains brand names:
BRANDS = [\'Samsung\', \'Apple\', \'Nike\', .....]
Dataframe A has following structure
You can achieve the result you are after by writing a simple function. You can then use .apply() with a lambda function to generate your desired column.
def contains_any(s, arr):
for item in arr:
if item in s: return item
return np.nan
df['brand_name'] = df['product'].apply(lambda x: match_substring(x, product_map))