datafile=OS. Path. Join (datasets' D: \ Downloads \ ', 'test1. TSV)
Df=pd read_csv (datafile, sep='\ t' escapechar='\ \')
Print (' Number of reviews: {} '. The format (len (df)))
Df [' clean_review]=df review. The apply (clean_text) # data cleaning work
Print (" test data is as follows: \ n ", df, head ())
Number of reviews: 1.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
AttributeError Traceback (the most recent call last)
2 df=pd read_csv (datafile, sep='\ t' escapechar='\ \')
3 print (' Number of reviews: {} '. The format (len (df)))
- & gt; Df [' clean_review]=df 4. Review the apply (clean_text) # data cleaning work
5 print (" test data is as follows: \ n ", df, head ())
~ \ Anaconda3 \ lib \ site - packages, pandas, core, generic. Py in.__getattr__ (self, name)
5065 if self. _info_axis. _can_hold_identifiers_and_holds_name (name) :
5066 return self [name]
-> 5067 the return object. The.__getattribute__ (self, name)
5068
5069 def __setattr__ (self, name, value) :
AttributeError: 'DataFrame' object has no attribute 'review'