Skip to content

FIX Adds more informative error message for OHE#26931

Merged
adrinjalali merged 4 commits intoscikit-learn:mainfrom
thomasjpfan:ohe_error_message_set_output
Jul 31, 2023
Merged

FIX Adds more informative error message for OHE#26931
adrinjalali merged 4 commits intoscikit-learn:mainfrom
thomasjpfan:ohe_error_message_set_output

Conversation

@thomasjpfan
Copy link
Copy Markdown
Member

Reference Issues/PRs

Fixes #26515

What does this implement/fix? Explain your changes.

This PR adds a more informative error message to OHE when sparse_output=True and there is pandas output.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 29, 2023

✔️ Linting Passed

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

Generated for commit: 713207f. Link to the linter CI: here

Copy link
Copy Markdown
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.

CI failing?

raise ValueError(
"Pandas output does not support sparse data. Set"
" sparse_output=False to output pandas DataFrames or disable pandas"
" output."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
" output."
" output via `ohe.set_output(transform="default")."

Copy link
Copy Markdown
Contributor

@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @thomasjpfan

@adrinjalali adrinjalali merged commit dcf0510 into scikit-learn:main Jul 31, 2023
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 18, 2023
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
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.

Improve error message with pandas output and sparse data

3 participants