title: Expected 2D array, got 1D array instead: array=[1 3 5 6 7 8 9]?
body: <pre><code>x=[1,3,5,6,7,8,9]
  y=[4,5,6,9,3,4,6]
  
  def linear_model_main(X_parameters,Y_parameters,predict_value):
   
   # Create linear regression object
   regr = linear_model.LinearRegression()
   regr.fit(x, y)
   predict_outcome = regr.predict(predict_value)
   predictions = {}
   predictions['intercept'] = regr.intercept
   predictions['coefficient'] = regr.coef
   predictions['predicted_value'] = predict_outcome
   predicted_value = predict_outcome
   #return predicted_value
   return predictions
  
  
  
  predictvalue = 7000
  result = linear_model_main(x,y,predictvalue)
  print (&quot;Intercept value &quot; , result['intercept'])
  print (&quot;coefficient&quot; , result['coefficient'])
  print (&quot;Predicted value: &quot;,result['predicted_value'])
  </code></pre>
  <p>I got this error when fit function is called: <code>regr.fit(x, y)</code></p>
  <p>ValueError: Expected 2D array, got 1D array instead:
  array=[1 3 5 6 7 8 9].
  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>