consider the X_test_raw series
X_test_raw = pd.Series( ['Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat...', 'Ok lar... Joking wif u oni...', 'PLEASE DON\'T FAIL' ], [0, 1, 3])
X_test_raw does not have index 2 , which you are trying to set with X_test_raw[2] .
Use iloc
X_test_raw.iloc[2] "PLEASE DON'T FAIL"
You can iterate through a series using iteritems
for index_val, series_val in X_test_raw.iteritems(): print series_val Go until jurong point, crazy.. Available only in bugis n great world la e buffet... Cine there got amore wat... Ok lar... Joking wif u oni... PLEASE DON'T FAIL
source share