Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fit3 = pf.feols("Y ~ X1 + X2 | f1", data = df)
### Bug Fixes

- Fixes an import-time failure on Python 3.13 in some environments where a `narwhals` typing alias was exposed as a string at runtime. This could cause imports of `feols()` / `feglm()` to fail before any model code ran. See [#1263](https://github.com/py-econometrics/pyfixest/issues/1263) for details.
- Clarifies `pf.etable()` significance-star behavior after the migration to `maketables`: stars are rendered only when `coef_fmt` includes `*` on a statistic token, for example `b*` or `b:.3f*`.

## PyFixest 0.50.0

Expand Down
7 changes: 5 additions & 2 deletions pyfixest/report/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ def etable(
Type of output. Either "df" for pandas DataFrame, "md" for markdown,
"gt" for great_tables, or "tex" for LaTeX table. Default is "gt".
signif_code : list, optional
Significance levels for the stars. Default is None, which sets [0.001, 0.01, 0.05].
If None, no stars are printed.
Significance levels for the stars. Default is None, which sets
[0.001, 0.01, 0.05]. Note that stars are only rendered if `coef_fmt`
includes `*` on a statistic token, for example `b*` or `b:.3f*`.
coef_fmt : str, optional
The format of the coefficient (b), standard error (se), t-stats (t), and
p-value (p). Default is `"b \n (se)"`.
To render significance stars, include `*` on the relevant token, following
maketables syntax, for example `"b* \n (se)"` or `"b:.3f* \n (se:.3f)"`.
Spaces ` `, parentheses `()`, brackets `[]`, newlines `\n` are supported.
custom_stats: dict, optional
A dictionary of custom statistics that can be used in the coef_fmt string to be displayed
Expand Down
12 changes: 12 additions & 0 deletions tests/test_summarise.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ def test_summary():
etable(fit_qreg)


def test_etable_significance_stars_follow_coef_fmt():
data = get_data()
fit1 = feols("Y ~ X1", data=data)
fit2 = feols("Y ~ X1 + X2 | f1", data=data)

default_table = etable([fit1, fit2], type="df")
assert not any("*" in str(value) for value in default_table.to_numpy().ravel())

custom_fmt_table = etable([fit1, fit2], type="df", coef_fmt="b* (se)\nt [p]")
assert any("*" in str(value) for value in custom_fmt_table.to_numpy().ravel())


@pytest.mark.skip("Pyfixest PR is not yet merged into stargazer.")
def test_stargazer():
data = pf.get_data()
Expand Down
Loading