结巴分词出现AttributeError: 'float' object has no attribute 'decode'错误

这个问题感觉很奇怪,报错的地方前后都没有数值,但就是报错。所以在读该文档的时候就将该dataframe格式转为str,就没有问题了
train = pd.read_csv("train.csv",encoding='utf-8',dtype=str)
train=train.astype(str)###################这个地方是解决方案
for index, row in train.iterrows():
words = jieba.cut(row['content'])
for word in words:
    print(word)
 
原文地址:https://www.cnblogs.com/kjkj/p/10724650.html