如何修复“ ..”和“ float”实例之间不支持的“ ..”

时间:2019-05-28 11:31:39

标签: python pandas loops

我正在尝试使用一个函数运行循环,但是我得到并出错。我是Python的新手,所以我不确定为什么不能将循环应用于字典。

代码如下:

def run_levenshtein(x):
    hits = []
    print(x)
    scores = {}

    for s1 in x.sequence[x.mc>0]:
        print(s1)
        scores[s1] = {}

        for s2 in x.sequence[x.mc==0]:
           print(s1 + "_" + s2)
           scores[s1][s2] = Levenshtein.seqratio(s1,s2)

           if scores > 0.8:
           hits.append([s1,s2])
        print(scores)

    return scores

 seqr = missed_cleavages.groupby('accession').apply(lambda x: run_levenshtein(x))

错误消息:

TypeError: '>' not supported between instances of 'dict' and 'float'

我希望有一个相似分数> 0.8的字典。

谢谢。

0 个答案:

没有答案