The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Simple Linear Regression with sklearn – Summary Table

Simple Linear Regression with sklearn – Summary Table

0
Votes
1
Answer

Hi, I am still getting error when i use predict function.reg.predict(1740). The error is ValueError: Expected 2D array, got scalar array instead, even though I have used reshape function as said previously.x_matrix = x.values.reshape(-1,1)
x_matrix.shape…… Please advise

1 Answer

365 Team

Hi Manish, 
the reg.predict(1740) doesn’t appear to be running in the newer versions of Python. Instead you could try the following:
new_array = np.array(1740).reshape(-1,1)
reg.predict(new_array)
Do let us know if there is still an issue.
Best, 
365 Eli
 

×
LAST CHANCE
Ready to Learn Data Science?
50% OFF