You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
specifying float_format doesn't have any effect result_ols.summary2(float_format="%.8f")
In the actual table creation the format is hardcoded.
However, there might be other problems because settings has 3 dictionaries with conflicting values, and not all methods involved in the table creation might use the same settings.
@josef-pkt FWIW, I dug into this and here is what I am seeing:
There are three settings because there are three subtables for OLS:
The output of summary2.Summary.summary_model, which corresponds to the first setting but float_format is hard-coded in the code so there is nothing to be set.
The output of summary2.Summary.summary_params, which corresponds to the second setting. This is what your commit referred to with settings[1].
The output of diagnostics, which corresponds to the third setting but float_format is hard-coded again.
I think there are two paths forward:
Actually enable float_format in summary2 by making all three settings use the float_format that's passed into summary2.
Deprecate float_format from summary2: since it has no effect anyway, this simply means updating docs, etc.
I think solution 1.5 would work: to only enable the float_format in the params table. Both of the other tables have very heterogeneous numbers and I don't think it's very useful to change the numbers for those.
Can the float_format for the params table be a list of format strings so users can adjust the print precision of the columns separately?
If you want to add the dict option additional to the list option, then it would be possible to use the names of the attributes (which IMO are nicer than the names that are printed as header of the params table, i..e. "pvalues" instead of "P>???"). Also, in that case I would use only one key in the dictionary for "confint" instead of separate formatting of lower and upper bound.
Hi, I'm still having this problem. I have all new installs of pandas, statsmodels, and everything else (as of February 2024). Using summary2(float_format='%.3f') has no effect. Am I missing something? In fact, I can put any text, integers, or boolean value in the float_format parameter and it will return the same result.
Activity
BUG: summary2 use float_format when creating `_simple_tables` see sta…
kiyoto commentedon Aug 2, 2015
@josef-pkt FWIW, I dug into this and here is what I am seeing:
There are three settings because there are three subtables for OLS:
summary2.Summary.summary_model, which corresponds to the first setting butfloat_formatis hard-coded in the code so there is nothing to be set.summary2.Summary.summary_params, which corresponds to the second setting. This is what your commit referred to withsettings[1].float_formatis hard-coded again.I think there are two paths forward:
float_formatin summary2 by making all three settings use thefloat_formatthat's passed intosummary2.float_formatfrom summary2: since it has no effect anyway, this simply means updating docs, etc.josef-pkt commentedon Aug 2, 2015
@kiyoto Thanks for digging.
I think solution 1.5 would work: to only enable the
float_formatin the params table. Both of the other tables have very heterogeneous numbers and I don't think it's very useful to change the numbers for those.Can the float_format for the params table be a list of format strings so users can adjust the print precision of the columns separately?
kiyoto commentedon Aug 2, 2015
@josef-pkt
I believe so. We can do something like,
float_formatis passed in as a list, then it applies formatting per column.float_formatis passed in as a string, then it applies the same formatting to all columns.I can also imagine passing a python dict, but it's not all too clear what the field names should be.
If this sounds like a plan, PR coming up.
josef-pkt commentedon Aug 2, 2015
Sounds good.
If you want to add the dict option additional to the list option, then it would be possible to use the names of the attributes (which IMO are nicer than the names that are printed as header of the params table, i..e. "pvalues" instead of "P>???"). Also, in that case I would use only one key in the dictionary for "confint" instead of separate formatting of lower and upper bound.
BUG: summary2 use float_format when creating `_simple_tables` see sta…
BUG: summary2 use float_format when creating `_simple_tables` see sta…
BUG: summary2 use float_format when creating `_simple_tables` see sta…
Merge pull request #5655 from bashtage/josef-pkt-summary2_format_1964
blincolm commentedon Mar 25, 2024
Hi, I'm still having this problem. I have all new installs of pandas, statsmodels, and everything else (as of February 2024). Using summary2(float_format='%.3f') has no effect. Am I missing something? In fact, I can put any text, integers, or boolean value in the float_format parameter and it will return the same result.
EDIT:
Python 3.12.2
statsmodels.version
0.14.0
pandas.version
2.1.4
numpy.version
1.26.4
ALSO TRIED (environment with):
Python 3.9.13
statsmodels.version
0.13.5
pandas.version
1.4.4
numpy.version
1.23.5