x = [[4, 2, 3, 4, 5, 4, 5, 6, 7, 4, 8, 9, 8, 8, 6, 6, 5, 5, 5, 5, 5, 5, 5],
    [4, 1, 2, 3, 4, 5, 6, 7, 5, 8, 7, 8, 7, 8, 7, 8, 7, 7, 7, 7, 7, 6, 5],
    [4, 1, 2, 5, 6, 7, 8, 9, 7, 8, 7, 8, 7, 7, 7, 7, 7, 7, 6, 6, 4, 4, 4]]

def reg_m(y, x):
    ones = np.ones(len(x[0]))
X = sm.add_constant(np.column_stack((x[0], ones)))
for ele in x[1:]:
    X = sm.add_constant(np.column_stack((ele, X)))
results = sm.OLS(y, X).fit()
return results
Multiple linear regression in Python