我正在尝试使用以下代码将句子拆分成单词:
for index, row in train.iterrows():
words_filtered = [e.lower() for e in row.text.split() if len(e) >= 3]
words_without_stopwords = [word for word in words_filtered if not word in stopwords_set]
reviews.append((words_without_stopwords, row.Sentiment))
但是我得到了错误:
Traceback (most recent call last):
File "<pyshell#44>", line 2, in <module>
words_filtered = [e.lower() for e in row.text.split() if len(e) >= 3]
File "C:\Python27\lib\site-packages\pandas\core\generic.py", line 5067, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'text'
无法解决该问题