1

I have dataframe of two columns. First one is correct strings, second is corrupted. I wanna apply Jaro-Winkler distance and store it in the new third column.

import pandas as pd
from pyjarowinkler.distance import get_jaro_distance

df = pd.DataFrame(
        {"Correct" : ['Hello' , 'bread' , 'situation'],
         "Corrupt" : ['Hlloe' , 'braed' , 'sitatuion']},
        index = [1, 2, 3])
Arthur
  • 13
  • 1
  • 3

1 Answers1

5
df['res'] = [get_jaro_distance(x, y) for x, y in zip(df['Correct'], df['Corrupt'])]
    Correct Corrupt res
1   Hello   Hlloe   0.88
2   bread   braed   0.95
3   situation   sitatuion   0.97

help-ukraine-now
  • 3,850
  • 4
  • 19
  • 36