Skip to content

Add support for bools in SimpleImputer #31730

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ritvi-alagusankar
Copy link
Contributor

Reference Issues/PRs

Fixes #26292

Changes in PR:

  • Added support for boolean data in SimpleImputer for NumPy arrays and pandas DataFrames. Updated _validate_input to recognize boolean dtypes and set dtype to bool.
  • Added relevant test cases which verifies correct imputation and output dtype across different strategies

Copy link

github-actions bot commented Jul 9, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: e3c6de4. Link to the linter CI: here

@ritvi-alagusankar ritvi-alagusankar marked this pull request as draft July 9, 2025 11:57
@ritvi-alagusankar ritvi-alagusankar marked this pull request as ready for review July 9, 2025 12:12
Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Could you please parametrise the dataframe tests and make sure things work as well for polars?

@Charlie-XIAO I wonder if there's a cleaner way to implement this?

@@ -0,0 +1,3 @@
:class:`impute.SimpleImputer` now supports boolean data types for
NumPy arrays and pandas DataFrames.
By :user:`[Ritvi Alagusankar] <ritvi-alaguankar>`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
By :user:`[Ritvi Alagusankar] <ritvi-alaguankar>`.
By :user:`Ritvi Alagusankar <ritvi-alaguankar>`.

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.

Add support for bools in SimpleImputer
2 participants