import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt

df = pd.read_csv('home_prices.csv')
df


%matplotlib inline
plt.xlabel('area')
plt.ylabel('price')
plt.scatter(df.area,df.price,color='red',marker='+')


new_df = df.drop('price',axis='columns')
new_df

price = df.price
price


# Create linear regression object
reg = linear_model.LinearRegression()
reg.fit(new_df,price)


reg.predict([[3300]])

reg.coef_

reg.predict([[5000]])


area_df = pd.read_csv("areas.csv")
area_df.head(3)


p = reg.predict(area_df)
p



area_df['prices']=p
area_df


area_df.to_csv("prediction.csv")
36be8eb4a80369ac02cf0ced537db665a84f67ef
import pandas as pd
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt

df = pd.read_csv('home_prices.csv')
df


%matplotlib inline
plt.xlabel('area')
plt.ylabel('price')
plt.scatter(df.area,df.price,color='red',marker='+')


new_df = df.drop('price',axis='columns')
new_df

price = df.price
price


# Create linear regression object
reg = linear_model.LinearRegression()
reg.fit(new_df,price)


reg.predict([[3300]])

reg.coef_

reg.predict([[5000]])


area_df = pd.read_csv("areas.csv")
area_df.head(3)


p = reg.predict(area_df)
p



area_df['prices']=p
area_df


area_df.to_csv("prediction.csv")