pandas:有没有办法为简单的OLS回归输出指定标题

时间:2016-05-09 02:50:31

标签: python pandas regression

我想知道是否有办法为简单的OLS回归输出指定标题。我有以下回归输出,我将做其中的一些。我希望它看起来像下面这样:

MODEL 1: OLS Regression Results ## This is a preferred title

Dep. Variable:  billsum_support     R-squared:  0.019
Model:  OLS     Adj. R-squared:     0.017
Method:     Least Squares   F-statistic:    15.63
Date:   Mon, 09 May 2016    Prob (F-statistic):     5.15e-23
Time:   04:32:43    Log-Likelihood:     -6110.2
No. Observations:   6597    AIC:    1.224e+04
Df Residuals:   6588    BIC:    1.230e+04
Df Model:   8       
Covariance Type:    nonrobust       
    coef    std err     t   P>|t|   [95.0% Conf. Int.]
const   0.9745  0.032   30.570  0.000   0.912 1.037
years_exp   3.882e-05   0.001   0.057   0.955   -0.001 0.001
leg_totalbills  0.0017  0.001   2.538   0.011   0.000 0.003
log_diff_rgdp   0.4085  0.222   1.838   0.066   -0.027 0.844
unemployment    -0.0099     0.004   -2.785  0.005   -0.017 -0.003
expendituresfor     6.519e-06   8.07e-07    8.082   0.000   4.94e-06 8.1e-06
direct_expenditures     1.334e-05   1.56e-06    8.533   0.000   1.03e-05 1.64e-05
indirect_expenditures   -6.823e-06  9.27e-07    -7.358  0.000   -8.64e-06 -5e-06
Republican  0.0806  0.017   4.839   0.000   0.048 0.113
sen     0.0441  0.024   1.847   0.065   -0.003 0.091
Omnibus:    2344.287    Durbin-Watson:  1.717
Prob(Omnibus):  0.000   Jarque-Bera (JB):   17321.494
Skew:   1.507   Prob(JB):   0.00
Kurtosis:   10.344  Cond. No.   1.55e+15

1 个答案:

答案 0 :(得分:1)

打印('模型1:OLS回归结果')这当然是Python 3,您可以查找print命令以查看如何将变量替换为字符串的任何部分...所以如果你正在循环你可以使用循环计数器来修改字符串..