text_html_output_1.png
import pandas as pd

import statsmodels.formula.api as smf

url = 'https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/datasets/swiss.csv'
df = pd.read_csv(url, index_col=0)

df.columns = ['fertility', 'agri', 'exam', 'edu', 'catholic', 'infant_mort']

formula = 'fertility ~ %s' % ' + '.join(df.columns.values[1:])
formula

lin_reg = smf.ols(formula, data=df).fit()
lin_reg.summary()