Add formula support to descriptive_stats#261
Closed
neuralsorcerer wants to merge 8 commits intofacebookresearch:mainfrom
Closed
Add formula support to descriptive_stats#261neuralsorcerer wants to merge 8 commits intofacebookresearch:mainfrom
descriptive_stats#261neuralsorcerer wants to merge 8 commits intofacebookresearch:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds formula support to the descriptive_stats function, allowing users to customize which columns and dummy variables are included when computing weighted summary statistics. The formula parameter provides fine-grained control over model matrix generation, taking precedence over the existing numeric_only parameter.
Changes:
- Added a
formulaparameter todescriptive_stats()that accepts either a string or list of strings to customize model matrix generation - Updated function logic to apply the formula when provided, before falling back to existing numeric_only behavior
- Added comprehensive tests covering formula usage with numeric columns, categorical columns, and mixed DataFrames
- Updated CHANGELOG.md to document the new feature
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| balance/stats_and_plots/weighted_stats.py | Added formula parameter to function signature, updated docstring, and modified logic to handle formula-based model matrix generation |
| tests/test_stats_and_plots.py | Added 4 test cases covering formula with single numeric column, categorical column, purely numeric DataFrame, and list of formulas |
| CHANGELOG.md | Added new feature entry describing the formula parameter functionality |
talgalili
requested changes
Jan 14, 2026
talgalili
requested changes
Jan 14, 2026
talgalili
requested changes
Jan 14, 2026
Contributor
talgalili
left a comment
There was a problem hiding this comment.
Please see my previous comments (nothing todo from copilot at this point)
|
@talgalili has imported this pull request. If you are a Meta employee, you can view this in D90681336. |
|
This pull request has been merged in 4a8ee27. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
formulaargument todescriptive_statsso model matrices for non-numeric columns can be customized, and documented the new parameter in the function docstring.