Export

params.csv and fit.png.

Write params.csv and fit.png.

Goal

Print the CSV and save a figure.

import pandas as pd
import statsmodels.api as sm
fit = sm.OLS([126.0, 94.5, 31.5], sm.add_constant([12, 9, 3])).fit()
fit.params.to_csv('params.csv')
print(open('params.csv').read())
import pandas as pd
plt.scatter([12, 9, 3], [126, 94.5, 31.5])
plt.savefig('fit.png', dpi=120, bbox_inches='tight')
plt.show()
print('wrote fit.png')