I'm trying to figure out if there's a way to do fuzzy merges of string in Pandas based on the difflib SequenceMatcher ration. Basically, I have two dataframes that look like this:
df_a
company address merged
Apple PO Box 3435 1
df_b
company address
Apple Inc PO Box 343
And I want to merge like this:
df_c = pd.merge(df_a, df_b, how = 'left', on = (difflib.SequenceMatcher(None, df_a['company'], df_b['company']).ratio() > .6) and (difflib.SequenceMatcher(None, df_a['address'], df_b['address']).ratio() > .6)
There are a few posts that are close to what I'm looking for, but none of them work with what I want to do. Any suggestions on how to do this kind of fuzzy merge using difflib?