
    >hsZ                         S SK Jr  S SKJr  S SKrS SKJr  S SKrS SKrS SK	r
S SKrSSKJr  SSKJrJr   " S S	5      rS
 rSSSSSSSS.rS r  SS jrSS jrSS jrS r   SS jrS S jr   S!S jrS"S jrg)#    )FUTURE_STACK)lzipN)reduce   )SimpleTable)	fmt_latexfmt_txtc                       \ rS rSrS rS rS rS rS r  SS jr	SS jr
SS	 jrS
 rSS jr  SS jrS rS rSS jrSrg)Summary   c                 J    / U l         / U l        / U l        S U l        SU l        g )NF)tablessettings	extra_txttitle_merge_latexselfs    mC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\statsmodels/iolib/summary2.py__init__Summary.__init__   s&    
!    c                 "    U R                  5       $ N)as_textr   s    r   __str__Summary.__str__   s    ||~r   c                 X    [        [        U 5      5      S-   U R                  5       -   S-   $ )Nz
"""
z
""")strtyper   r   s    r   __repr__Summary.__repr__   s%    4:*T\\^;gEEr   c                 "    U R                  5       $ )z$Display as HTML in IPython notebook.)as_htmlr   s    r   _repr_html_Summary._repr_html_   s    ||~r   c                 "    U R                  5       $ )z9Display as LaTeX when converting IPython notebook to PDF.)as_latexr   s    r   _repr_latex_Summary._repr_latex_"   s    }}r   c                 z    X#XES.nU R                   R                  U5        U R                  R                  U5        g)aE  
Add the contents of a DataFrame to summary table

Parameters
----------
df : DataFrame
header : bool
    Reproduce the DataFrame column labels in summary table
index : bool
    Reproduce the DataFrame row labels in summary table
float_format : str
    Formatting to float data columns
align : str
    Data alignment (l/c/r)
indexheaderfloat_formatalignN)r   appendr   )r   dfr-   r.   r/   r0   r   s          r   add_dfSummary.add_df&   s6    $ #$0B2X&r   c                 T    [         R                  " U5      nU R                  USSX2S9  g)zAdd the contents of a Numpy array to summary table

Parameters
----------
array : numpy array (2D)
float_format : str
    Formatting to array if type is float
align : str
    Data alignment (l/c/r)
Fr,   N)pd	DataFramer3   )r   arrayr0   r/   tables        r   	add_arraySummary.add_array=   s,     U#Eu!- 	 	<r   c                    UR                  5        Vs/ s H  n[        XT5      PM     nnUR                  5        Vs/ s H  n[        XT5      PM     nn[        R                  " [        Xg5      5      nUR                  S   U-  S:w  aF  X(R                  S   U-  -
  n	[        R                  " U[        R                  " U	SS//-  5      /5      n[        R                  " X5      n[        S U5      nU R                  XS9  gs  snf s  snf )ae  Add the contents of a Dict to summary table

Parameters
----------
d : dict
    Keys and values are automatically coerced to strings with str().
    Users are encouraged to format them before using add_dict.
ncols : int
    Number of columns of the output table
align : str
    Data alignment (l/c/r)
float_format : str
    Formatting to float data columns
r    c                 0    [         R                  " X/5      $ r   )nphstackxys     r   <lambda>"Summary.add_dict.<locals>.<lambda>f   s    299aV#4r   r0   N)keys
_formattervaluesr?   r8   r   shapevstacksplitr   r:   )
r   dncolsr0   r/   rB   rG   valsdatapads
             r   add_dictSummary.add_dictM   s      67VVX>X
1+X>56XXZ@Z
1+Z@xxT()::a=5 A%::a=501C99dBHHSRH:-=$>?@Dxx$4d;t) ?@s
   DDc                 :    U R                   R                  U5        g)zAppend a note to the bottom of the summary table. In ASCII tables,
the note will be wrapped to table width. Notes are not indented.
N)r   r1   )r   strings     r   add_textSummary.add_texti   s     	f%r   Nc                     [        U[        5      (       a  Xl        gUb>  UR                  R                  R
                  nU[        ;   a	  [        U   nSU-   U l        gSU l        g)zInsert a title on top of the summary table. If a string is provided
in the title argument, that string is printed. If no title string is
provided but a results instance is provided, statsmodels attempts
to construct a useful title automatically.
Nz	Results: r=   )
isinstancer   r   model	__class____name___model_types)r   r   resultsrZ   s       r   	add_titleSummary.add_titleo   sV     eS!!J"//88L((/E(50

r   c                     [        XUR                  S9n[        U5      nUb  XWl        Ub  XhS'   U R	                  USS9  U R                  XsS9  U R                  XAS9  g)a  Try to construct a basic summary instance.

Parameters
----------
results : Model results instance
alpha : float
    significance level for the confidence intervals (optional)
float_format: str
    Float formatting for summary of parameters (optional)
title : str
    Title of the summary table (optional)
xname : list[str] of length equal to the number of parameters
    Names of the independent variables (optional)
yname : str
    Name of the dependent variable (optional)
)alphause_tNDependent Variable:lrF   )r/   )r   r^   )summary_paramsrc   summary_modelr-   rR   r3   r_   )	r   r^   rb   r/   r   xnameynameparaminfos	            r   add_baseSummary.add_base   sd    & w7==IW%K*/&'d#&E5U4r   c                    U R                   nU R                  nU R                  nU R                  n[	        X5      u  pVnUS-  n[        XXV5      n	U	 V
s/ s H  oR                  5       PM     nn
SR                  U5      nUR                  S5      nXS'   UR                  U5        SR                  U5      nUb5  Un[        U5      U:  a#  S[        US-  [        U5      S-  -
  5      -  U-   nOSnU V
s/ s H  n
[        R                  " X5      PM     nn
U V
s/ s H  n
SR                  U
5      PM     nn
SR                  U5      nSR                  X;U/5      nU$ s  sn
f s  sn
f s  sn
f )z%Generate ASCII Summary Table
        =
r       r=   )r   r   r   r   _measure_tables_simple_tablesr   joinrL   r1   leninttextwrapwrap)r   r   r   r   r   pad_col	pad_indexwidest
rule_equalsimple_tablesrB   tabtxtouts                 r   r   Summary.as_text   sK    ==

NN	%4V%F"Fc\
&vL$12Mqyy{M2iiniioA

:iinE5zF"c&1*s5zA~"=>>FE1:;Ax}}Q';%()Styy|S)iiniiS)*
+ 3 <)s   E5 E#E(c                 \   U R                   nU R                  n[        X5      nU Vs/ s H  oDR                  5       PM     nnSR	                  U5      nU R
                   Vs/ s H  ofR                  SS5      PM     nnSR	                  U5      nSR	                  XX/5      n	U	$ s  snf s  snf )z$Generate HTML Summary Table
        rp   z<br/>
)r   r   rt   r$   ru   r   replace)
r   r   r   r~   rB   r   sttemp_txtr   r   s
             r   r$   Summary.as_html   s     ==&v8$12Mqyy{M2iin9=H2JJtY/HnnX&nncZ(
 3 Is   B$"B)c                    U R                   nU R                  nU R                  nUb	  SU-   S-   nOSnSU-   S-   n[        X#5      nU Vs/ s H  ofR	                  5       PM     nnSR                  U5      nSnU R                  (       a  [        R                  " USU5      nSXAUS	4n	S
R                  U	5      n	SR                  U R                  5      n
U	S-   U
-   nU$ s  snf )zGenerate LaTeX Summary Table

Parameters
----------
label : str
    Label of the summary table that can be referenced
    in a latex document (optional)
z	\caption{}z
\caption{}z\label{z

z8\\hline\n\\hline\n\\end{tabular}\n\\begin{tabular}{.*}\nz\\midrule\nz\begin{table}z\end{table}rp   z \newline 
z

\bigskip
)
r   r   r   rt   as_latex_tabularru   r   resubr   )r   labelr   r   r   r~   rB   r   
to_replacenon_captionedr   r   s               r   r(   Summary.as_latex   s     ==

 5(3.E!EU"S(&v8-:;]!!#];kk#A
 &&^S9C(%^K		-0""4>>2o-3
! <s   
C)r   r   r   r   r   )TT%.4fr)r   r   )rr   re   r   NN)皙?r   NNN)r=   )r\   
__module____qualname____firstlineno__r   r   r!   r%   r)   r3   r:   rR   rV   r_   rl   r   r$   r(   __static_attributes__ r   r   r   r      s^    "F @F'.< *8& " HL#'5:#J$%r   r   c                    [        X5      nU Vs/ s H  o3R                  5       PM     nnU Vs/ s H  n[        UR                  5       S   5      PM!     nn[	        U5      n/ n/ n[        [        U5      5       Ha  n	[	        X	   R                  S   S-
  S5      n
[        XeU	   -
  U
-  5      nUR                  U5        XY   X-  -   nUR                  Xl-
  5        Mc     Xx[	        U5      4$ s  snf s  snf )zCompare width of ascii tables in a list and calculate padding values.
We add space to each col_sep to get us as close as possible to the
width of the largest table. Then, we add a few spaces to the first
column to pad the rest.
r   r   )	rt   r   rv   
splitlinesmaxrangerJ   rw   r1   )r   r   r~   rB   r   lengthlen_maxpad_sepr{   inseprQ   len_news                r   rs   rs      s     #64M -
.199;C
..12cc!,,.#$cF2&kGGI3s8_69??1%)1-7AY&$./s)dj(*+  s6{** /2s
   C,&C1zOrdinary least squareszGeneralized least squaresz$Generalized least squares with AR(p)zWeighted least squareszRobust linear modelzNegative binomial modelzGeneralized linear model)OLSGLSGLSARWLSRLMNBinGLMc                    S n0 nS US'   S US'   S US'   S US	'   XS
'   S US'   S US'   S US'   S US'   S US'   S US'   S US'   S US'   S US'   U R                   (       a  SOSnS US U-   S!-   '   S" US#U-   S!-   '   S$ US%'   S& US''   S( US)'   S* US+'   S, US-'   S. US/'   S0 US1'   S2 US3'   S4 US5'   S6 US7'   S8 US9'   0 nUR                  5        H  u  pV U" U 5      XE'   M     U$ ! [        [        [        4 a     M.  f = f):z0
Create a dict with information about the model
c                  `    [         R                   R                  5       nUR                  S5      $ )Nz%Y-%m-%d %H:%M)datetimenowstrftime)argskwdsr   s      r   time_nowsummary_model.<locals>.time_now%  s&    ##%||,--r   c                 B    U R                   R                  R                  $ r   )rZ   r[   r\   rB   s    r   rD   summary_model.<locals>.<lambda>*  s    qww0099r   zModel:c                 B    U R                   R                  R                  $ r   )family__classr\   r   s    r   rD   r   +  s    ahh&6&6&?&?r   zModel Family:c                 V    U R                   R                  R                  R                  $ r   )r   linkr[   r\   r   s    r   rD   r   ,  s    qxx}}'>'>'G'Gr   zLink Function:c                 .    U R                   R                  $ r   )rZ   endog_namesr   s    r   rD   r   -  s    AGG,?,?r   rd   zDate:c                      SU R                   -  $ Nz%#6d)nobsr   s    r   rD   r   /  s    &166/r   zNo. Observations:c                      SU R                   -  $ r   )df_modelr   s    r   rD   r   0  s    &1::"5r   z	Df Model:c                      SU R                   -  $ r   )df_residr   s    r   rD   r   1  s    fqzz&9r   zDf Residuals:c                      U R                   S   $ )N	convergedmle_retvalsr   s    r   rD   r   2  s    1==#=r   z
Converged:c                      U R                   S   $ )N
iterationsr   r   s    r   rD   r   3  s    l(Cr   zNo. Iterations:c                     U R                   $ r   )methodr   s    r   rD   r   4  s    r   zMethod:c                      U R                   S   $ )Nnormfit_optionsr   s    r   rD   r   5  s    ammF3r   zNorm:c                      U R                   S   $ )N	scale_estr   r   s    r   rD   r   6  s    AMM+$>r   zScale Est.:c                      U R                   S   $ )Ncovr   r   s    r   rD   r   7  s    1==#7r   z
Cov. Type:r=   z (uncentered)c                      SU R                   -  $ Nz%#8.3f)rsquaredr   s    r   rD   r   :  s    1::8Mr   	R-squared:c                      SU R                   -  $ r   )rsquared_adjr   s    r   rD   r   ;  s    X=Vr   zAdj. R-squaredc                      SU R                   -  $ r   )	prsquaredr   s    r   rD   r   <  s    (Q[[*@r   zPseudo R-squared:c                      SU R                   -  $ Nz%8.4f)aicr   s    r   rD   r   =      Wquu_r   zAIC:c                      SU R                   -  $ r   )bicr   s    r   rD   r   >  r   r   zBIC:c                      SU R                   -  $ Nz%#8.5g)llfr   s    r   rD   r   ?  s    155(8r   zLog-Likelihood:c                      SU R                   -  $ r   )llnullr   s    r   rD   r   @  s    AHH!4r   zLL-Null:c                      SU R                   -  $ r   )
llr_pvaluer   s    r   rD   r   A  s    X%<r   zLLR p-value:c                      SU R                   -  $ r   )deviancer   s    r   rD   r   B  s    (QZZ"7r   z	Deviance:c                      SU R                   -  $ Nz%#6.3g)pearson_chi2r   s    r   rD   r   C  s    h&?r   zPearson chi2:c                      SU R                   -  $ )Nz%#8.4g)fvaluer   s    r   rD   r   D  s    X%8r   zF-statistic:c                      SU R                   -  $ r   )f_pvaluer   s    r   rD   r   E  s    Hqzz,Ar   zProb (F-statistic):c                      SU R                   -  $ r   )scaler   s    r   rD   r   F  s    x!''1r   zScale:)
k_constantitemsAttributeErrorKeyErrorNotImplementedError)r^   r   rk   rsquared_typer   keyfuncs          r   rg   rg      s   
. D9DN?DGD	"?D	M 9D	5D9D=DCD	(DO3DM>D7D!,,B/M.MD}	$s	*+3VD	M	)C	/0 @D	,DL,DL8D	4D<D7D?D8D"AD	1DN
CZZ\		G}CH " J	 *=> 	 	s   
C//DDc           
         [        U [        5      (       a  U u  pppOAU R                  nU R                  nU R                  n	U R
                  n
U R                  U5      n[        R                  " XxX/5      R                  n[        R                  " X/5      n[        R                  " U5      nU(       a/  SSSSS[        US-  5      -   [        SUS-  -
  5      S-   /Ul        O.SSS	S
S[        US-  5      -   [        SUS-  -
  5      S-   /Ul        U(       d(   U R                  R                   R"                  Ul        U$ X,l        U$ ! [&         a    U R                  R(                  Ul         U$ f = f)a  create a summary table of parameters from results instance

Parameters
----------
res : results instance
    some required information is directly taken from the result
    instance
yname : {str, None}
    optional name for the endogenous variable, default is "y"
xname : {list[str], None}
    optional names for the exogenous variables, default is "var_xx"
alpha : float
    significance level for the confidence intervals
use_t : bool
    indicator whether the p-values are based on the Student-t
    distribution (if True) or on the normal distribution (if False)
skip_header : bool
    If false (default), then the header row is added. If true, then no
    header row is added.
float_format : str
    float formatting options (e.g. ".3g")

Returns
-------
params_table : SimpleTable instance
zCoef.zStd.Err.tzP>|t|[rr   r   ]zzP>|z|)rY   tupleparamsbsetvaluespvaluesconf_intr?   r8   Tr@   r6   r7   r   columnsrZ   rP   param_namesr-   r   
exog_names)r^   ri   rh   rb   rc   skip_headerr/   r  r  r  r  r  rP   s                r   rf   rf   R  s[   : '5!!;B8wkk////##E*88V'3466D99d%&D<<DS'c%!)n,c!eai-.@3.FH  S'c%!)n,c!eai-.@3.FH 	2 ++77DJ K 
K  	2 11DJ K	2s   %E %E10E1c                   ^ [        U 5      nUR                  SS  H  nXE   R                  U4S j5      XE'   M     SUR                  SS2S4   -   S-   UR                  SS2S4'   U(       a  UR                  SS2S4   S:  nUR                  XdR                  S	   4   S
-   UR                  XdR                  S	   4'   UR                  SS2S4   S:  nUR                  XdR                  S	   4   S
-   UR                  XdR                  S	   4'   UR                  SS2S4   S:  nUR                  XdR                  S	   4   S
-   UR                  XdR                  S	   4'   UR                  SS2SS24   nUR
                  " S0 [        D6nU(       a  [        U S[        R                  5      n[        U S[        R                  5      n[        R                  " UUS.5      n	U	R                  5       R                  5       (       a+  U	R                  U4S j5      n	[        R                  " XI/S	S9n[        R                  " U5      n[!        U R"                  R$                  5      /Ul        U$ )z<Stack coefficients and standard errors in single column
    Nrr   c                    > TU -  $ r   r   rB   r/   s    r   rD   _col_params.<locals>.<lambda>  s
    L1,<r   (r   )   g?r   *r   g{Gz?r   r   )r   r=   )zR-squared Adj.r=   c                    > TU -  $ r   r   r  s    r   rD   r    s
    L1$4r   )axisr   )rf   r
  applyiloclocstackr   getattrr?   nanr6   Seriesnotnullanyconcatr7   r   rZ   r   )
resultr/   stars
include_r2rescolidxr   r   r2s
    `        r   _col_paramsr*    s   
 
 C{{2A8>>"<=  388AqD>)C/CHHQTNhhq!tnr!'*wwsKKN/B'Cc'I[[^#$hhq!tns"'*wwsKKN/B'Cc'I[[^#$hhq!tns"'*wwsKKN/B'Cc'I[[^#$
((1bqb5/C
))
#l
#C 6:rvv6v~rvv>YY80<> ? ::<45B))SIA.C
,,s
Cv||//01CKJr   c                 \   Uc  0 n/ n/ nU HG  n[        X   [        5      (       a  M   UR                  X   " U 5      5        UR                  U5        MI     [        R
                  " [        U R                  R                  5      U0US9nU$ ! [         a    UR                  S5         Nhf = f)z!Stack model info in a column
    r=   )r-   )	rY   dictr1   r   r6   r7   r   rZ   r   )r#  	info_dictr   r-   r   s        r   	_col_infor.    s     	
CEilD))	JJy|F+, 	Q  ,,FLL445s;5
ICJ	  	JJrN	s   BB+*B+c                     [        [        U 5      5      [        U 5      :X  a  U $ SSKJn  U" [        5      n/ nU  H(  nX$==   S-  ss'   UR                  US-   X$   -   5        M*     U$ )Nr   )defaultdictIrq   )rv   setcollectionsr0  r   r1   )list_of_namesr0  name_counterr.   _names        r   _make_uniquer7    sh    
3}#m"44's#LFs"eckL$778  Mr   c                 	   [        U [        5      (       d  U /n U  Vs/ s H  n[        XUUS9PM     n	nU(       a  [        U5      n
O([        U	 Vs/ s H  oR                  S   PM     sn5      n
[        [        U	5      5       H  nX   /X   l        M     S n[        U	S   R                  5      nU	SS  H.  nUR                   H  nX;  d  M
  UR                  U5        M     M0     S H7  nUU;   d  M  UR                  U5        UR                  [        U5      U5        M9     [        X5      nUR                  U5      nU(       Ga  UR                  R                  S5      R                  5       n[        R                   " U5      R#                  5       nUR$                  US:H     R                  R                  5       nU Vs/ s H  oU;   d  M
  UPM     nnU Vs/ s H  oU;  d  M
  UPM     nnUU-   nUR                  R                  S5       Vs/ s H  nUU;  d  M  UPM     nnUU-  nU(       a  U H  nUR                  U5        M     UR                  USS9n/ nUR                  R                  S5      n[        SUR&                  S   S5       Hb  nUR                  X   5        US-   UR&                  S   :  a   X   XS-      :X  a  UR                  S	5        ML  UR                  XS-      5        Md     UUl        U(       aJ  U  Vs/ s H<  n[)        XR+                  UR,                  R.                  R0                  U5      5      PM>     n	nO'U  Vs/ s H  n[)        U[3        US
S5      5      PM     n	n[5        U	[        U	 Vs/ s H  nUR                  S   PM     sn5      5       H  u  nnU/Ul        M     [        X5      n[        R6                  " [8        R:                  " UU/5      5      nUR                  Ul        [        R<                  " UR                  R                  5       UR                  R                  5       -   5      Ul        UnUR?                  S	5      n[A        5       nSUl!        URE                  USSS9  URG                  S5        U(       a  URG                  S5        U$ s  snf s  snf s  snf s  snf s  snf s  snf s  snf s  snf )a  
Summarize multiple results instances side-by-side (coefs and SEs)

Parameters
----------
results : statsmodels results instance or list of result instances
float_format : str, optional
    float format for coefficients and standard errors
    Default : '%.4f'
model_names : list[str], optional
    Must have same length as the number of results. If the names are not
    unique, a roman number will be appended to all model names
stars : bool
    print significance stars
info_dict : dict, default None
    dict of functions to be applied to results instances to retrieve
    model info. To use specific information for different models, add a
    (nested) info_dict with model name as the key.
    Example: `info_dict = {"N":lambda x:(x.nobs), "R2": ..., "OLS":{
    "R2":...}}` would only show `R2` for OLS regression models, but
    additionally `N` for all other results.
    Default : None (use the info_dict specified in
    result.default_model_infos, if this property exists)
regressor_order : list[str], optional
    list of names of the regressors in the desired order. All regressors
    not specified will be appended to the end of the list.
drop_omitted : bool, optional
    Includes regressors that are not specified in regressor_order. If
    False, regressors not specified will be appended to end of the list.
    If True, only regressors in regressor_order will be included.
include_r2 : bool, optional
    Includes R2 and adjusted R2 in the summary table.
)r$  r/   r%  r   c                 &    U R                  USSSS9$ )NouterT)howright_index
left_index)mergerA   s     r   mergsummary_col.<locals>.merg  s    wwqg4DwIIr   r   Nr  rr   )levelr=   default_model_infosTre   )r.   r0   zStandard errors in parentheses.z* p<.1, ** p<.05, ***p<.01)$rY   listr*  r7  r
  r   rv   r-   r1   removeinsertr   reindexget_level_valuestolistr6   r  value_countsr  rJ   r.  getrZ   r[   r\   r  zipr7   r?   rK   Indexfillnar   r   r3   rV   )r^   r/   model_namesr$  r-  regressor_orderdrop_omittedr%  rB   colscolnamesr   r?  r-   r'  r   specialsummvarnamesvcordered	unordered	new_orderotheruor(  r2   namerk   datsmrys                                  r   summary_colr_    sW   J gt$$) 9@A8?1 \#-/8? 	 A ,t <t!1t <=3t9#;- J aEABx99CS!   ?eLL!LLUW- ?
 $D<<D::..q188:YYx --/66"'?((//1-?oh1o? (E1_,DQ	Ei'	 JJ77: (:qY& : (U	  $  ||IQ|/
CJJ''*E1ekk!na(

58EU[[^#Uq5\)AJJrNJJuU|$ ) DJ @GI@G1 !]]177+<+<+E+E+46 7@G 	 I  KL	!WQ(=tDE 	  lD+IDbBJJqMD+IJKDV
 L $D
,,ryy$.
/C,,CK**,tzz/@/@/BBCCID;;r?D9DDKKTK-MM3423K_A !=2 @E((I ,JsB   R7R<	SS	S*S
S"SAS!SSc                      X-  nUR                  5       $ ! [         [        4 a    [        U 5      n UR                  5       $ f = fr   )
ValueError	TypeErrorr   strip)elementr/   r   s      r   rH   rH   R  sH    $ 99; 	" 'l99;s    AAc
                   ^ U R                  5       n
 U
R                  U4S j5      n
U(       a4  U
R                  R                  5        Vs/ s H  n[        U5      PM     nnOS nU(       aC  U
R                  R                  5        Vs/ s H  n[        U5      [        U	5      S-  -   PM     nnOOU
R                  S S 2S4    Vs/ s H  n[        U5      [        U	5      S-  -   PM     snU
R                  S S 2S4'   S n[        [        R                  " U
5      X[        [        S9nXR                  S   S'   XR                  S   S'   XR                  S	   S'   X^R                  S	   S
'   XnR                  S	   S'   X~R                  S	   S'   S[        US-   5      -  UR                  S	   S'   U$ ! [         a    U
R                  U4S j5      n
 GNf = fs  snf s  snf s  snf )Nc                    > [        U T5      $ r   rH   r  s    r   rD   $_df_to_simpletable.<locals>.<lambda>_  s    
1l ;r   c                    > [        U T5      $ r   rg  r  s    r   rD   rh  a  s    Z<%@r   rq   r   )headersstubsltx_fmttxt_fmtlatexdata_alignsheader_alignr   table_dec_abovetable_dec_belowheader_dec_belowr   colsep)copymapr   applymapr
  rH  r   r-   rw   r  r   r?   r8   r   r	   output_formats)r2   r0   r/   r.   r-   rq  rr  rs  rz   r{   r]  rB   rj  rk  r   s     `            r   _df_to_simpletablery  Z  s    '')CBgg;< #&;;#5#5#78#7a3q6#788;		8H8H8JK8J1Q#i.3..8JK $'88AqD>3#1a a&3y>C#77#13A	RXXc]G&
9B05g}-16g~..3e]+2Ae./2Ae./3Ce/0),s7Q;/?)?BeX&I+  Bll@AB 9 L3s#   F/ G$G$G/GGc                    / nU(       a  US   S   OSnUc  S/[        U 5      -  nUc  S/[        U 5      -  n[        U 5       H:  u  pgX   S   nX   S   n	X   S   n
UR                  [        XzUXX&   X6   S95        M<     U$ )Nr   r/   r   r-   r.   r0   )r0   r/   r.   r-   rz   r{   )rv   	enumerater1   ry  )r   r   rz   r{   r~   r/   r   vr-   r.   r0   s              r   rt   rt   x  s    M2:8A;~.L#F#C#f+%	&!G$X&G$/=I7=8?
:C,	H 	I	 " r   )NNr   TFr   )r   TFr   )r   r   FNr   FT)r   )	r   r   TT-Nr}  r   r   r   )statsmodels.compat.pandasr   statsmodels.compat.pythonr   r   	functoolsr   r   rx   numpyr?   pandasr6   r9   r   tableformattingr   r	   r   rs   r]   rg   rf   r*  r.  r7  r_  rH   ry  rt   r   r   r   <module>r     s    2 *   	     /i iX+4 02?/,11/d FJ399z$N*
 EJAFwt CGHLBC<r   