Last answered:

17 Feb 2022

Posted on:

15 Feb 2022

0

codes on line 15 do not work

reg.predict(new_data) works fine, but the subsequent code on line 15 to add the predicted values back to the data frame does not. thanks.

3 answers ( 0 marked as helpful)
Instructor
Posted on:

16 Feb 2022

0

Hey Christine,

Thank you for your question!

As the sklearn library is changing with time, there have been some modifications to the predict() method and the input values it takes. This problem has been resolved in the following thread.

Hope this helps!

Kind regards,
365 Hristina

Posted on:

16 Feb 2022

0

Thanks. I looked at the solution being linked, but still can't figure out the codes. My code: reg.predict(new_data) works, but the subsequent one to add the predicted values back to the dataframe does not.
new_data['Predicted_GPA'] = reg.predict(new_data)

Can you please help modify the above code? Thanks much!

Instructor
Posted on:

17 Feb 2022

0

Hey Christine,

Try out the implementation below:

image.png

Let me know if this worked for you!

Kind regards,
365 Hristina

Submit an answer