結巴分詞出現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