I am preprocessing the data in a CSV file using python and pandas. I am getting this error : 'Series' object has no attribute 'split'.
Here is the code segment.
def load_data():
data = pd.read_csv('/content/drive/My Drive/Colab Notebooks/Project/Uber_Ride_Reviews.csv')
return data
tweet_df = load_data()
tweet_df.head()
tweet_df.drop_duplicates(subset='ride_review',keep=False, inplace=True)
print(tweet_df)
def removeStopWords(text):
clean_word_list = [word for word in text.split() if word not in stoplist]
return clean_word_list
And the following code segment gives the error mentioned above.
tweet_df['removeStopwords']=removeStopWords(tweet_df['text'])
Complete description of the error is as follows.
AttributeError Traceback (most recent call last) <ipython-input-21-be4e0c836a5b> in <module>()
--> 101 tweet_df['removeStopwords']=removeStopWords(tweet_df['text'])
102
103
3 frames pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()
/usr/local/lib/python3.6/dist-packages/pandas/core/generic.py in
__getattr__(self, name) 5177 if self._info_axis._can_hold_identifiers_and_holds_name(name): 5178 return self[name]
-> 5179 return object.__getattribute__(self, name) 5180 5181 def __setattr__(self, name, value):
AttributeError: 'Series' object has no attribute 'split'
How can i fix the issue? Thank you in advance