我想在我的数据框审查中创建一个新列,给出对象类型的列文本的语言。
我尝试转换为字符串,然后使用 langdetect 中的检测函数,但是当我运行代码时仍然存在类型错误。
我不明白这个问题大声笑
我的代码:
from langdetect import detect
review['langue'] = detect((review['text']).astype(str))
实际结果 :
--------------------------------------------------------------------------
TypeError Traceback (most recent call last)
TypeError: expected string or bytes-like object