I have a dataframe df1 such as the following that has a list of tags.
tags
0 label
0 document
0 text
0 paper
0 poster
...
21600 wood
21600 hot tub
21600 tub
21600 terrace
21600 blossom
There's another dataframe df2 that has mappings to the tags present in df mapped to a column name 'name'.
name iab
0 abies Nature and Wildlife
1 absinthe Food & Drink
2 abyssinian Pets
3 accessories Style & Fashion
4 accessory Style & Fashion
... ... ... ... ...
1595 rows × 4 columns
Essentially, the idea is to search the column 'name' in df2 that correspond to the tags in df1 to find corresponding 'iab' mappings and output a CSV that has two columns - tags and it's corresponding 'iab' mappings.
The Output would look something like this :
tags iab
0 label <corresponding iab mapping
to 'name' found in df2>
0 document
0 text
0 paper
0 poster
...
21600 wood
21600 hot tub
21600 tub
21600 terrace
21600 blossom
I need help in achieving this. Thank you in advance!
Note:
What I tried is
df_iab[df_iab['name'].isin(df['image_CONTAINS_OBJECT'])]
But that would only cut down df2 to 'iab' that match 'tags' but not really perform a search and map found values.