Skip to content

Conversation

@leweex95
Copy link

@leweex95 leweex95 commented Dec 7, 2025

When using FeatureUnion with set_config(transform_output="polars"), the operation failed with polars.exceptions.DuplicateError because the ContainerAdapterProtocol.hstack() interface was incomplete: it didn't accept a feature_names parameter to apply column renaming before concatenation.

Fixes #32852

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. It looks correct to me but I think the testing of pandas and polars should be decoupled:

assert_array_equal(X_trans.columns, union.get_feature_names_out())
assert_array_equal(X_trans.index, X_test.index)

# Test with polars
Copy link
Member

Choose a reason for hiding this comment

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

I would rather use @pytest.mark.parametrize(df_library, ["pandas", "polars"]) so that the full test is not marked as skipped if only one of the two libs is installed.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback, very valid point, fixed it in the new commit.

leweex95 and others added 2 commits December 8, 2025 20: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.

FeatureUnion with polars output fails due to missing column renaming in adapter interface

2 participants