Skip to content

FIX get_feature_names_out drops reference columns when drop_original=… - #1120

Open
RugvedBane wants to merge 2 commits into
feature-engine:mainfrom
RugvedBane:fix/issue_1103
Open

RugvedBane wants to merge 2 commits into
feature-engine:mainfrom
RugvedBane:fix/issue_1103

Conversation

@RugvedBane

Copy link
Copy Markdown

Fixes #1103

Problem

When drop_original=True, DatetimeSubtraction.transform() and
RelativeFeatures.transform() correctly drop both variables_ and
reference columns from the output. However, get_feature_names_out()
only excluded variables_, causing a column-length mismatch when using
set_output(transform="pandas").

Fix

Updated _add_new_feature_names in _base_transformers/mixins.py to
also exclude reference columns when drop_original=True.

Tests

Added regression tests for both transformers covering:

  • get_feature_names_out() correctness with drop_original=True
  • set_output(transform="pandas") no longer raises ValueError

@RugvedBane

Copy link
Copy Markdown
Author

Hi @solegalli, please take a look at this PR when you get a chance. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DatetimeSubtraction reports dropped reference columns and breaks pandas output

1 participant