【发布时间】:2019-01-14 21:25:17
【问题描述】:
我有以下数据
group exog endog
A 1.2 0.23
A 1.3 0.34
A 1.4 0.45
B 1.5 0.56
B 1.6 0.67
B 1.7 0.78
C 1.8 0.89
C 1.9 1
C 2 1.11
像这样:
def regression(df, exog, endog):
import statsmodels.api as sm
reg2 = sm.OLS(endog=df[exog],
exog=df[endog],
missing='drop')
results = reg2.fit()
df_ols_coefs = results.params.to_frame().T
df_ols_coefs.columns = [str(col) + '_coef' for col in df_ols.columns]
return df_ols_coefs
我想过从原始数据帧制作“子”数据帧,但我被卡住了。 我应该选择类似的东西吗:
for df in df_orginal:
NOW I AM STUCK
? 解释真的会帮助我:D 谢谢!
【问题讨论】:
-
你能详细解释一下是什么样的处理吗?