title: Variables: IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
body: <p>I'm working on a support vector regression and I'm trying to split dataset in train and test. When I run my model I receive this error:</p>
  <pre><code>    ---------------------------------------------------------------------------
  IndexError                                Traceback (most recent call last)
  &lt;ipython-input-46-c24eb12af231&gt; in &lt;module&gt;
       20 
       21 # Identify min and max values for input variables
  ---&gt; 22 x_min, x_max = X_test_scaled['synth_index'].min(), X_test_scaled['synth_index'].max()
       23 y_min, y_max = X_test_scaled['ln_GDP_level'].min(), X_test_scaled['ln_GDP_level'].max()
       24 
  
  IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
  </code></pre>
  <p>I just tried to convert variables with:</p>
  <pre><code>df['synth_index'].astype(np.int64)
  df['ln_GDP_level'].astype(np.int64)
  </code></pre>
  <p>but the error persists.</p>
  <p>How can I solve it? This is the piece of code that gives me an error (I talked with the author of previous code and there was a piece of the code missing!)</p>
  <pre><code>X=df[['synth_index','ln_GDP_level']]
  y=df['median_rating'].values
  
  X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42,
                                                     test_size=0.30)
  scaler = preprocessing.StandardScaler().fit(X_train)
  X_train_scaled = scaler.transform(X_train)
  X_test_scaled = scaler.transform(X_test)
  
  model1 = LinearRegression()
  model2 = SVR(kernel='rbf', C=100, epsilon=1)
  
  # Fit the two models 
  lr = model1.fit(X_test_scaled, y_test)
  svr = model2.fit(X_test_scaled, y_test)
  
  # ----------- For creating a prediction plane to be used in the visualization -----------
  # Set Increments between points in a meshgrid
  mesh_size = 1
  
  # Identify min and max values for input variables
  x_min, x_max = X_test_scaled['synth_index'].min(), X_test_scaled['synth_index'].max()
  y_min, y_max = X_test_scaled['ln_GDP_level'].min(), X_test_scaled['ln_GDP_level'].max()
  
  # Return evenly spaced values based on a range between min and max
  xrange = np.arange(x_min, x_max, mesh_size)
  yrange = np.arange(y_min, y_max, mesh_size)
  
  # Create a meshgrid
  xx, yy = np.meshgrid(xrange, yrange)
  
  # ----------- Create a prediction plane  -----------
  # Use models to create a prediction plane --- Linear Regression
  pred_LR = model1.predict(np.c_[xx.ravel(), yy.ravel()])
  pred_LR = pred_LR.reshape(xx.shape)
  
  # Use models to create a prediction plane --- SVR
  pred_svr = model2.predict(np.c_[xx.ravel(), yy.ravel()])
  pred_svr = pred_svr.reshape(xx.shape)
  </code></pre>
  <p>Database was read with this code (Pandas):</p>
  <pre><code>datafile = (r'C:\Users\gpont\PycharmProjects\pythonProject2\data\Map\databaseCDP0.csv')
  
  df = pd.read_csv(datafile, skiprows = 0, sep=';')
  
  df
  
  df['median_rating'] = df['median_rating'].astype(float)
  print()
    
  # let's find out the data type after changing
  print(df.dtypes)
    
  # print dataframe. 
  df
  </code></pre>
  <p>Database:</p>
  <p><a href="https://i.stack.imgur.com/xct3E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xct3E.png" alt="enter image description here" /></a></p>
  <p>Database type:</p>
  <p><a href="https://i.stack.imgur.com/2RFhP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2RFhP.png" alt="enter image description here" /></a></p>