-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature to automatically rename categorical variables in etable #798
Conversation
Codecov ReportAttention: Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…variables in a dataframe
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
Hi @s3alfisc, thanks for reviewing this PR! I just realized that I forgot to mention that when using "i(x, ref=v)" then having blanks in category (i.e. level) names leads to an error. That is, i(gender, ref="Male") works well but i(ethnicity, ref="Native American") leads to "ValueError: Value |
Ah ok, I see! I think we should treat this as a bug of the Btw, I have also changed the default to not apply the relabeling by default - the reason is that I think there should be consistency in internal variable naming and users should explicitly ask for renaming. Else we might run into users who see variables names in etable() but struggle to understand how they might relate to what is included in |
Yes, that all makes sense, thanks!
From: Alexander Fischer ***@***.***>
Sent: Friday, February 7, 2025 4:28 PM
To: py-econometrics/pyfixest ***@***.***>
Cc: KT Sliwka Dirk ***@***.***>; Author ***@***.***>
Subject: Re: [py-econometrics/pyfixest] Add feature to automatically rename categorical variables in etable (PR #798)
"i(x, ref=v)" then having blanks in category (i.e. level) names leads to an error.
Ah ok, I see! I think we should treat this as a bug of the i() parser and I might open a separate issue for it?
Btw, I have also changed the default to not apply the relabeling by default - the reason is that I think there should be consistency in internal variable naming and users should explicitly ask for renaming. Else we might run into users who see variables names in etable() but struggle to understand how they might relate to what is included in .coef(), .tidy() or .summary()?
—
Reply to this email directly, view it on GitHub<#798 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALY442WHAZPDX6OV6XLPGST2OTGJRAVCNFSM6AAAAABV3P4TVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBTGI2DONRSGA>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Merged this one for now, thanks Dirk! On the i-ref and white space issue - let's see if I will manage to fix it, if not happy to discuss bringing back the |
Thanks!!
From: Alexander Fischer ***@***.***>
Sent: Friday, February 7, 2025 4:36 PM
To: py-econometrics/pyfixest ***@***.***>
Cc: KT Sliwka Dirk ***@***.***>; Author ***@***.***>
Subject: Re: [py-econometrics/pyfixest] Add feature to automatically rename categorical variables in etable (PR #798)
Merged this one for now, thanks Dirk! On the i-ref and white space issue - let's see if I will manage to fix it, if not happy to discuss bringing back the set_first_cat function =)
—
Reply to this email directly, view it on GitHub<#798 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALY442R4DPY2TZY2YFWDNC32OTHFBAVCNFSM6AAAAABV3P4TVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBTGI3DIMRYGE>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
This adds a feature to etable that automatically renames categorical variables in regression tables. The user can specify a formatting template (default is "{variable}={value}"). It should work either for pandas categoricals (i.e "y ~ x + c" when c is categorical) and with categorical variables generated in the regression formula with the C() or i() operator.
To do this, the existing rename_categoricals function is slightly extended to allow using formatting templates.