'Extract values if column contains keywords in data frame
I have one column in a data frame like this;
| A |
|---|
| Apple banana cat |
| King blade night |
| Rose Dawn Jack |
I have two columns in other data frame like this;
| title | Key words |
|---|---|
| Happy | night |
| Sad | Dawn, Jack |
| Angry | Apple, BANANA |
I want to match column A with keywords ,if it contains any of keywords then I want to assign the appropriate title to a new column named as 'Group'. Do remembers the upper column is in different data frame than the lower one.
EDIT: Keywords are comma-separated and may contain both uppercase and lowercase values. in case of no match, column 'GROUP' should just give Nan.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
