I am trying to split a sentence into words using the following code:
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))
But i got the error:
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'
Can't figure out how to resolve this