Skip to content

Instantly share code, notes, and snippets.

@nduprincekc
Created March 9, 2021 09:19
Show Gist options
  • Select an option

  • Save nduprincekc/ed70854c4eb10e1ba532b256b0153dbd to your computer and use it in GitHub Desktop.

Select an option

Save nduprincekc/ed70854c4eb10e1ba532b256b0153dbd to your computer and use it in GitHub Desktop.
How to predict iphone price
import pandas
from sklearn.linear_model import LinearRegression
user = input('enter the price of iphone you want to know the predicted price: ')
data = pandas.read_csv('iphone_price.csv')
model = LinearRegression()
ode = LinearRegression()
ode.fit(data[['version']], data[['price']])
print(ode.predict([[user]]))
version price
1 499
2 599
3 599
4 649
5 649
6 749
7 769
8 799
9 949
10 999
11 1249
12 1399
@nduprincekc
Copy link
Author

how to predict iphone price

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment