def compare_except(s1, s2, exceptions=[]):
conc = pd.concat([s1, s2], axis=1, ignore_index=True)
def except_apply(x):
try:
str1 = x[0]
str2 = x[1]
for ex in exceptions:
str1 = str1.replace(ex, "")
return jellyfish.jaro_distance(str1, str2)
except Exception as err:
if pd.isnull(x[0]) or pd.isnull(x[1]):
return np.nan
else:
raise err
return conc.apply(except_apply, axis=1)
评论列表
文章目录