from sklearn.datasets import load_iris
import pandas as pd
from patsy import dmatrices
iris = load_iris()
names = [f_name.replace(' ', '_').strip('_(cm)') for f_name in iris.
    feature_names]
iris_df = pd.DataFrame(iris.data, columns=names)
iris_df['species'] = iris.target
y, X = dmatrices('species ~ ' + '+'.join(iris_df.columns - ['species']),
    iris_df, return_type='dataframe')
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X, y)
print(model.score(X, y))
print(model.intercept_, model.coef_)
Fit model to all variables in Python (Scikit Learn)