Instead of passing individual parameters iteratively, I am passing the whole column but still it is taking the same amount of time.
It is taking approx 1 Minute which is very long.....
Here is the code
from fuzzywuzzy import fuzz
import json
import pandas as pd
import time
k = pd.read_csv(r"/home/hamza/Downloads/retrosynthesis1-all.csv")
k.dropna()
word = input(" Enter String : ")
t0 = time.time()
patterns = pd.DataFrame(data=k['Target'])
print(type(patterns))
result = pd.DataFrame(data=k['Reactant'])
w=[word for i in range(len(patterns))]
wd = pd.DataFrame(data=w, columns=['input'])
df = pd.concat([wd, patterns, result], axis=1, sort=False)
print(df)
def get_ratio(row):
name = row['input']
name1 = row['Target']
return fuzz.partial_ratio(name, name1)
res = df[df.apply(get_ratio, axis=1) > 70]