title: Fitting SVC model on Khan Gene Data Set in Python
body: <p>I have four <code>.csv</code> files containing the training data (data points and their classes) plus test data (data points and their classes) that has been stored into <code>X_train</code>, <code>y_train</code>, <code>X_test</code> and <code>y_test </code> variables respectively.</p>
  <p>I need to train a CSV model and test it with the test data and as <code>sklearn.svm.SVC</code> gets <code>numpy</code> arrays as input I tried converting <code>pandas</code> data frames to <code>numoy</code> arrays as follows:</p>
  <pre><code>X_train_gene = pd.read_csv(&quot;Khan_xtrain.csv&quot;).drop('Unnamed: 0', axis=1).values.ravel()
  y_train_gene = pd.read_csv(&quot;Khan_ytrain.csv&quot;).drop('Unnamed: 0', axis=1).values.ravel()
  X_test_gene = pd.read_csv(&quot;Khan_xtest.csv&quot;).drop('Unnamed: 0', axis=1).values.ravel()
  y_test_gene = pd.read_csv(&quot;Khan_ytest.csv&quot;).drop('Unnamed: 0', axis=1).values.ravel()
  </code></pre>
  <p>Then I tried the following lines of code to train my model:</p>
  <pre><code>from sklearn.svm import SVC
  svm_gene = SVC(C=10, kernel='linear')
  svm_gene.fit(X_train_gene, y_train_gene)
  </code></pre>
  <p>But I get a value error:</p>
  <blockquote>
  <p>ValueError: Expected 2D array, got 1D array instead:
  array=[ 0.7733437 -2.438405  -0.4825622 ... -1.115962  -0.7837286 -1.339411 ].
  Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.</p>
  </blockquote>
  <p>The full error message can be viewed in the following image:</p>
  <p><a href="https://i.stack.imgur.com/BnGEb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BnGEb.png" alt="The Error Message" /></a></p>
  <p>How can I fix this issue?</p>