结巴分词出现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)
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM