Solved by AladdinPerzon in post #2 
              
              
                I think the problem comes from the fact that y is a pandas dataframe and so you can’t just index directly, I think you need to do y.iloc[i,:] or something similar.