AttributeError: 'float' object has no attribute 'lower'

I get the feeling that your problems has its root in the pd.read_csv('TrainSA.csv') function. Althought you did not post this routine I assume it is Pandas read_csv. This routine intelligently converts input to python datatypes. However this means that in your case some values could be translated to a float. You can prevent this intelligent (?) behaviour by specifying which datatypes you expect for each column.


Thank you @Dick Kniep. Yes,it is Pandas CSV reader. Your suggestion worked. Following is the python code which worked for me by specifying the field datatype, (in this case, its string)

p_test = pd.read_csv('TrainSA.csv')
p_test.SentimentText=p_test.SentimentText.astype(str)