Hi, I am getting the same error too. In my case it’s similar to what you just explained. I am comparing 2 strings for their similarity and the script is returning a json containg 2 strings and their similarity percentage.
This is the script I am using, what am I missing? I m actually calling the function partial_match within UiPath.
import pandas as pd
from difflib import SequenceMatcher
#import time
def partial_match(file1,sheet1,file2,sheet2,threshold):
#start_time = time.time()
df = pd.DataFrame()
rows = []
exc1 = pd.read_excel(file1,sheet1)
exc2 = pd.read_excel(file2,sheet2)
for index, row in exc1.iterrows():
a = row["NameAlias_WholeName"]
for index, row2 in exc2.iterrows():
b = row2["First Name"]
simmilarity = round(SequenceMatcher(None,a,b).ratio()*100,2)
simmilarity = int(simmilarity)
if simmilarity > int(threshold):
#print(a," ",b," ",simmilarity,"%")
rows.append({'Col 1': a,'Col 2':b,'Col 3':simmilarity})
df = pd.concat([df, pd.DataFrame(rows)], axis=0, ignore_index=True)
return df.to_json(orient='records')