I have 2 dataframes and I want to find common matches based on a column (tld), once match has been found, I want to update column match as True. How to update column in destinat
Using isin
to update
df2.loc[df2.tld.isin(df1.tld),'match']=True
df2
Out[669]:
id website company_name tld match
0 a www.facebook.com facebook facebook.com True
1 b www.y.com YahooInc y.com False
2 c www.g.com Google g.com False
3 d www.g.com GoogleInc g.com False
4 e www.facebook.com FacebookInc facebook.com True
This will achieve what you want:
destination["match"] = destination["tld"].isin(source.tld)