convert python code to multiprocessing to increase the speed

Viewed 37

I'm new to multiprocessing can some one Please help me to convert below python code to parallel processing to increase the speed. Currently it is taking 22 hours for 46,000 records for name comparison

Code

similar_names=pd.DataFrame()
#name_list1 = ['amar','amarnath','amnana'....46799 records]
for i in range(len(name)):
    st_time=time.time()
    values=[fuzz.token_sort_ratio(name_list[i],x) for x in name_list if x!=name[i]]
#    print(values)
    keys=[x for x in name_ if x!=name[i]]
    dict0=dict(zip(keys, values))
    dict_sorted=sorted(dict0.items(), key=lambda x: (x[1], x[0]),reverse=True)
#    print(dict_sorted)
    similar_names[name[i]]=dict_sorted[:5]
0 Answers
Related