text_plain_output_1.png
from sklearn import linear_model

import matplotlib.pyplot as plt # Visualization

import pandas  as pd #Data manipulation

df = pd.read_csv('../input/insurance/insurance.csv')
df

from sklearn import linear_model
lin = linear_model.LinearRegression()

plt.scatter(df.age, df.charges)
plt.xlabel('Age')
plt.ylabel('Charges')
lin.fit(df[['age']], df.charges)
plt.plot(df.age, lin.predict(df[['age']]), color='red')
lin.predict([[40]])