The line reg.predict(1740) does not work anymore
The line reg.predict(1740) does not work anymore.
The new versions of sklearn requiere a matrix as input.
thus, it can be solved by using this code:
obs = 1740
obs_as_matrix = np.reshape(obs, (1,1))
reg.predict(obs_as_matrix)
Alternatively:
obs = 1740
obs_as_matrix = np.array([obs]).reshape(1, 1)
reg.predict(obs_as_matrix)
Or as a data frame:
obs = 1740
obs_as_matrix = pd.DataFrame({'SAT':[1740]})
reg.predict(obs_as_matrix)
4 answers ( 0 marked as helpful)
Thank you for the clarification
Thank you very much! I have had the same problem.
You are great, keep up the good work.
reg.predict([[1740]]) works as well