Untitled

 avatar
user_8080122
plain_text
2 years ago
558 B
2
Indexable
correlations = df.corr()
sns.heatmap(correlations, annot =True).set(title = 'heatmap of consumption data - Pearson Correlations');

df.plot(x='Average_income', y ='Petrol_Consumption', style = 'o')

X = df[['Average_income','Paved_Highways','Petrol_tax']]
y = df["Petrol_Consumption"]
X.head(2)

X = sm.add_constant(X)
model = sm.OLS(y,X).fit()
model.summary()

sns.regplot(x='Average_income', y='Petrol_Consumption' , data=df)
sns.histplot(model.resid)

actual_fitted = pd.DataFrame({'Actual':y,'Fitted':model.predict(X)})
actual_fitted

Editor is loading...