Solved by Dwight_Foster in post #2 
              
              
                The problem is that you cannot index a pandas dataframe. You should be able to do this instead 
self.words.iloc[index]