Created
August 9, 2015 16:16
-
-
Save ewalk153/4782b2c4b9e50638e2be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/19991445/run-an-ols-regression-with-pandas-data-frame | |
import pandas as pd | |
import statsmodels.formula.api as sm | |
df = pd.DataFrame({"A": [10,20,30,40,50], "B": [20, 30, 10, 40, 50], "C": [32, 234, 23, 23, 42523]}) | |
result = sm.ols(formula="A ~ B + C", data=df).fit() | |
print result.params | |
print result.summary() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment