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: array=1740. 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.
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