Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mberrien-fitzsimons/e8b3607bd4e66bf0a858c77ba327bcc3 to your computer and use it in GitHub Desktop.
Save mberrien-fitzsimons/e8b3607bd4e66bf0a858c77ba327bcc3 to your computer and use it in GitHub Desktop.
# import required library
from statsmodels.formula.api import ols
#Define the Problem
outcome = 'volume'
x_cols = ['Friday', 'Monday', 'Thursday', 'Tuesday', 'Wednesday']
#Fitting the actual model
predictors = '+'.join(x_cols)
formula = outcome + "~" + predictors
model = ols(formula=formula, data=msft_model_df).fit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment