![](/img/trans.png)
[英]How to solve: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
[英]how can i fix this: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
fasttext_embeddings = WordEmbeddings('en-crawl')
fasttext = Embeddings(fasttext_embeddings, min_similarity=0, model_id="FastText")
tfidf = TFIDF(min_similarity=0, model_id="TF-IDF")
rapidfuzz = RapidFuzz(n_jobs=-1, score_cutoff=0, model_id="RapidFuzz")
matchers = [tfidf, fasttext, rapidfuzz]
model = PolyFuzz(matchers)
model.match(Netflix['title'], IMBD['Title'])
我更喜欢追溯的复制粘贴,但图像是可读的(几乎没有)。 错误发生在一行
if to_list:
之前我们我们的默认值 fo to_list
是None
。 if
尝试跳过to_list
为None
或空列表的情况。 再往前追溯,我发现to_list
是match
调用中的第二个参数:
model.match(Netflix['title'], IMBD['Title'])
在你的情况下,这是一个熊猫系列。 if IMBD['Title']
: 会产生这个错误。
仔细检查文档,但看起来这个导入的模块需要列表作为参数。 如果您首先将系列转换为列表,则可能会起作用。
阅读函数文档,最好在使用之前阅读,但在遇到错误时更要阅读。 这和回溯是调试的关键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.