Skip to content Skip to sidebar Skip to footer

How To Find Similar Rows In Columns With Difflib?

Please, I have two CSV files with columns with company names. With Python3 and pandas I made a merge to compare the names: compara1 = pd.merge( dividas_dep, funrural, left_

Solution 1:

I think it only needed to show the result, I realized now:

def similar(a, b):
    threshold = 0.8
    s = SequenceMatcher(None, a, b).ratio() > threshold
    print(s)
    return s


for i, row in dividas_dep.iterrows():
    a = (row['Nome_Devedor'])
    for i, row in funrural.iterrows():
        b = (row['Razao_Social'])
        similar(a, b)
        print(a)
        print(b)
        print("-/-")

Post a Comment for "How To Find Similar Rows In Columns With Difflib?"