text_plain_output_1.png image_output_1.png
from sklearn.linear_model import LinearRegression

import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd
df_2 = pd.read_csv('/kaggle/input/usa-housing/USA_Housing.csv')
X = df_2[['Avg. Area Income']]
y = df_2['Price']
df_2.head

from sklearn.linear_model import LinearRegression
df_2 = LinearRegression()
df_2.fit(X_train, y_train)
predictions = df_2.predict(X_test)

import matplotlib.pyplot as plt
plt.scatter(X_train, y_train, color='g')
plt.plot(X_train, df_2.predict(X_train), color='k')