title: A column-vector y was passed when a 1d array was expected error while doing SVM?
body: <p>I am creating a SVM model with one independent variable X and dependent variable y.I performed feature scaling as both the data variable was not on same scale.</p>
  
  <p>Now when i am training a model on dataset i am getting error as :</p>
  
  <p>DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
    y = column_or_1d(y, warn=True).</p>
  
  <p>Below are the code snippet from which i am getting error:</p>
  
  <pre><code># Building Model on whole dataset
  
  from sklearn.svm import SVR
  regressor = SVR(kernel='rbf')
  regressor.fit(X,y)
  </code></pre>
  
  <p>Entire file:</p>
  
  <pre><code># Importing Libraries
  
  import numpy as np
  import matplotlib.pyplot as plt
  import pandas as pd
  
  # import data Set
  
  dataset = pd.read_csv('Position_Salaries.csv')
  X = dataset.iloc[:, 1:-1].values
  y = dataset.iloc[:, -1].values
  
  # Feature Scaling
  
  y = y.reshape(len(y), 1)
  
  # Feature Scaling
  
  from sklearn.preprocessing import StandardScaler
  sc_X = StandardScaler()
  sc_y = StandardScaler()
  X = sc_X.fit_transform(X)
  y = sc_y.fit_transform(y)
  
  # Building Model on training dataset
  
  from sklearn.svm import SVR
  regressor = SVR(kernel='rbf')
  regressor.fit(X,y)
  </code></pre>
  
  <p>File on which i am training my model</p>
  
  <p><a href="https://i.stack.imgur.com/pMBAq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pMBAq.png" alt="enter image description here"></a></p>