這個問題感覺很奇怪,報錯的地方前后都沒有數值,但就是報錯。所以在讀該文檔的時候就將該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)