rl_compare.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:labutils 作者: networks-lab 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号