I have two pandas df colums with populated with some names, first df has more name enteries, and second has less, e.g.
| id | names |
|---|---|
| 1 | John Doe |
| 2 | Jane Doe |
| id | names |
|---|---|
| 1 | John Doe |
I need to create a column with True/False in the first df, if names are matching, e.g.
| id | names | match |
|---|---|---|
| 1 | John Doe | True |
| 2 | Jane Doe | False |
so far I have tried this two methodes:
df['match'] = (df1.names is df2.names) # always return False df['match'] = df1.names.isin(df2.names) # compare only first names, eg. John, but doesn't the second Additionally I have tried to lowercase and remove strings, but still not getting the result
What am I doing wrong?
df1.names.isin(df2.names.tolist())