Skip to content

Add formula support to descriptive_stats#261

Closed
neuralsorcerer wants to merge 8 commits intofacebookresearch:mainfrom
neuralsorcerer:formula
Closed

Add formula support to descriptive_stats#261
neuralsorcerer wants to merge 8 commits intofacebookresearch:mainfrom
neuralsorcerer:formula

Conversation

@neuralsorcerer
Copy link
Collaborator

  • Added a formula argument to descriptive_stats so model matrices for non-numeric columns can be customized, and documented the new parameter in the function docstring.
  • Added appropiate tests to ensure descriptive_stats respects the supplied formula when selecting columns/dummies.

Copilot AI review requested due to automatic review settings January 14, 2026 07:40
@meta-cla meta-cla bot added the cla signed label Jan 14, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 formula parameter to descriptive_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

Copilot AI review requested due to automatic review settings January 14, 2026 08:12
@neuralsorcerer neuralsorcerer added this to the balance 0.15.0 milestone Jan 14, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

@talgalili talgalili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my previous comments (nothing todo from copilot at this point)

Copilot AI review requested due to automatic review settings January 14, 2026 13:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@meta-codesync
Copy link

meta-codesync bot commented Jan 14, 2026

@talgalili has imported this pull request. If you are a Meta employee, you can view this in D90681336.

@meta-codesync meta-codesync bot closed this in 4a8ee27 Jan 14, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 14, 2026

This pull request has been merged in 4a8ee27.

@neuralsorcerer neuralsorcerer deleted the formula branch January 14, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants