I have a list of names in df1 and I need to see if they match anywhere in df2. I know I probably need to use str.contains on each item and add one to a count, but I haven't figured out how to do this successfully.
for e in df2['People_separate']:
count = df1['People'].str.contains(e)
if count == True:
count += 1
return count
example: df1:
| People |
| -------- |
| A B / E F |
| A B / C D |
| E F |
df2 (looking to populate the 'counts' column:
| People_separate | Counts |
| --------------- | -------------|
| A B | 2 |
| C D | 1 |
| E F | 2 |