title: Sklearn ValueError: Expected 2D array, got 1D array instead:
body: <pre><code>import numpy as np
  import pandas as pd
  import matplotlib.pyplot as plt
  
  dataset = pd.read_csv('Admission_Predict_Ver1.1.csv')
  print(dataset)
  
  x1 = dataset.drop('SOP', axis='columns')
  print(x1)  
  
  x = dataset.iloc[:,1:-1].values 
  y = dataset.iloc[:,-1].values
  
  from sklearn.model_selection import train_test_split
  x_tr,x_te,y_tr,y_te = train_test_split(x,y,test_size = 0.2, random_state = 0) 
  
  from sklearn.linear_model import LinearRegression
  regressor = LinearRegression()
  regressor.fit(x_tr,y_tr) 
  
  y_pred = regressor.predict(x_te) 
  
  import pickle
  
  with open('model_pickle','wb') as f:
  pickle.dump(y_pred,f) 
  
  with open('model_pickle','rb') as f:
  pickle.load(f) 
  
  gre_score = float(input(&quot;Enter GRE Score: &quot;))
  toefl_score = float(input(&quot;Enter TOEFL Score: &quot;))
  university_rating = float(input(&quot;Enter University Rating: &quot;))
  cgpa = float(input(&quot;Enter CGPA: &quot;))
  research = float(input(&quot;Enter Research: &quot;)) 
  
  result = regressor.predict([gre_score,toefl_score,university_rating,cgpa,research]) 
  print(result) 
  </code></pre>
  <p>I'm trying deploy above machine learning model in the web application but at the time of printing prediction giving me below value error. What I have to do to solve it!</p>
  <pre><code>ValueError: Expected 2D array, got 1D array instead:
  array=[337.   118.     4.     4.5    9.65].
  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.
  </code></pre>