🛠️ Scheduled Maintenance | We’ll be undergoing scheduled maintenance and upgrades between 00:00 PST Jan 26th until 00:00 PST Jan 28th. There may be brief interruption of services in that period. We apologize for the inconvenience.

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.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Making prediction with Scikit learn

Making prediction with Scikit learn

Super Learner

Hey, i am getting following error while following your code line by line. I reshaped the x variable prior to performing regression. I ran the regression successfully and got the Coefficient, R squared etc. But when i run this code  ##reg.predict(1740), i get the following error .Thanks 

ValueError: Expected 2D array, got scalar array instead:
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.
1 Answer

365 Team

Hi Gurpinder,
Thanks for reaching out.
Please note that sklearn expects your data to be in 2D form.
To achieve that you can write:


And the problem will be fixed. 
Note that when we were recording the video, it was working even without the square brackets.
The 365 Team

Thanks very much for the reply, this solved my problem

8 months