Lindly
Lindly

Reputation: 23

How do I vectorize this function?

I have a function which utilizes jaro_winkler and I want to vectorize it. The function is given below:

def check_client(name):
    name = re.sub('\W+', ' ', name)
    name = re.sub('\*', '', name)
    
    for i in client_list:
        x = textdistance.jaro_winkler(i, name)
        if x > 0.93:
            return 'Yes'
    return 'No'

And I tried applying this function on a column in a dataframe by:

df_distinct['client'] = df_distinct['name'].apply(check_client)

I haven't really explored anything just yet but it would be great to have an input about this. Thank you!

Upvotes: 1

Views: 57

Answers (0)

Related Questions