-
-
Notifications
You must be signed in to change notification settings - Fork 26k
FIX Fix ColumnTransformer.get_feature_names_out with slices #22775
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a regression test (to test the new behavior does what it should), and add a what_new entry under the 1.1 version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix and the non-regression test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! I left minor comments on adjust the tests to test slices with more than one element.
( | ||
[ | ||
("bycol1", TransWithNames(), slice(1, 2)), | ||
("bycol2", "drop", ["d"]), | ||
], | ||
"passthrough", | ||
["bycol1__b", "remainder__a", "remainder__c"], | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we update this example to have a slice with more than one element?
(
[
("bycol1", TransWithNames(), slice(1, 3)),
],
"drop",
["bycol1__b", "bycol1__c"],
),
[ | ||
("bycol1", TransWithNames(), ["d", "c"]), | ||
("bycol2", "passthrough", slice(0, 1)), | ||
], | ||
"drop", | ||
["d", "c", "a"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here regarding slicing with more than one element:
[ | |
("bycol1", TransWithNames(), ["d", "c"]), | |
("bycol2", "passthrough", slice(0, 1)), | |
], | |
"drop", | |
["d", "c", "a"], | |
[ | |
("bycol1", TransWithNames(), ["d", "c"]), | |
("bycol2", "passthrough", slice(0, 2)), | |
], | |
"drop", | |
["d", "c", "a", "b"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogrisel @thomasjpfan Thanks for your feedback. I have pushed another commit incorporating your suggestions. Tx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reference Issues/PRs
Fixes #22774
What does this implement/fix? Explain your changes.
Currently, ColumnTransformer's get_feature_names_out does not work when the columns are specified as slices. This fix makes get_feature_names_out work properly with slices as well.
Any other comments?