I need to check for string containment and set the new column to the substring value. I am currently trying this
df['NEW_COL'] = df['COL_TO_CHECK'].str.contains('|'.join(substring_list))
instead of returning the boolean true false for containment... I need to return the actual value from substring_list that matches to populate df['NEW_COL]
SUBSTRINGS TO CHECK FOR
substring_list = ['apple', 'banana', 'cherry']
RESULTING DATAFRAME
OLD_COL NEW_COL
apple pie apple
black cherry cherry
banana lemon drop banana