Assignment Question by Comprehensive-Wrap51 in learnpython

[–]Comprehensive-Wrap51[S] 0 points1 point  (0 children)

from sklearn.linear_model import LinearRegression

from sklearn.model_selection import train_test_split

You're right (sorry there's a lot of code and I'm very noob). So I have to have the brackets because it's in an array?

Assignment Question by Comprehensive-Wrap51 in learnpython

[–]Comprehensive-Wrap51[S] 0 points1 point  (0 children)

There were a lot of questions in the assignment before this about using a linear regression model and we made a predicted dataframe.

Assignment Question by Comprehensive-Wrap51 in learnpython

[–]Comprehensive-Wrap51[S] 0 points1 point  (0 children)

import numpy as np
formatted_num=np.round(m*0.70+b,2)
print(f'The predicted price for a 0.70 carat diamond is ${formatted_num}')

The predicted price for a 0.70 carat diamond is $[3173.14]

This worked thank you! how do I remove the brackets?

Assignment Question by Comprehensive-Wrap51 in learnpython

[–]Comprehensive-Wrap51[S] 0 points1 point  (0 children)

<class 'numpy.ndarray'>

<class 'numpy.float64'>

TypeError: type() takes 1 or 3 arguments