From ca497af1bbefe3409d6ff3009f39e8dac033eea1 Mon Sep 17 00:00:00 2001 From: avinashtrivedix Date: Sun, 18 Oct 2026 01:00:35 +0530 Subject: [PATCH 1/3] Fix OneHotEncoder metadata dropping generated indicators (#1106) --- feature_engine/encoding/one_hot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/feature_engine/encoding/one_hot.py b/feature_engine/encoding/one_hot.py index 9d028475b..8d2bb2aa4 100644 --- a/feature_engine/encoding/one_hot.py +++ b/feature_engine/encoding/one_hot.py @@ -290,7 +290,7 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: X.drop(labels=self.variables_, axis=1, inplace=True) return X - + def inverse_transform(self, X: pd.DataFrame): """inverse_transform is not implemented for this transformer.""" raise NotImplementedError( @@ -308,7 +308,7 @@ def _get_new_features_name(self) -> List: def _add_new_feature_names(self, feature_names) -> List: """Adds new features to df columns, and removes categoricals.""" - feature_names = feature_names + self._get_new_features_name() feature_names = [f for f in feature_names if f not in self.variables_] - - return feature_names + feature_names = feature_names + self._get_new_features_name() + + return feature_names \ No newline at end of file From 2a64d2289784610c78a8961abac9c75d279c3415 Mon Sep 17 00:00:00 2001 From: avinashtrivedix Date: Sun, 18 Oct 2026 12:57:40 +0530 Subject: [PATCH 2/3] Fix flake8 trailing whitespace and newline and remove trailing whitespace on blank lines --- feature_engine/encoding/one_hot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/feature_engine/encoding/one_hot.py b/feature_engine/encoding/one_hot.py index 8d2bb2aa4..2fe29316e 100644 --- a/feature_engine/encoding/one_hot.py +++ b/feature_engine/encoding/one_hot.py @@ -290,7 +290,7 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame: X.drop(labels=self.variables_, axis=1, inplace=True) return X - + def inverse_transform(self, X: pd.DataFrame): """inverse_transform is not implemented for this transformer.""" raise NotImplementedError( @@ -310,5 +310,6 @@ def _add_new_feature_names(self, feature_names) -> List: """Adds new features to df columns, and removes categoricals.""" feature_names = [f for f in feature_names if f not in self.variables_] feature_names = feature_names + self._get_new_features_name() - - return feature_names \ No newline at end of file + + return feature_names + \ No newline at end of file From cc90385003bd86f918f5efced61a7c769a9a71e1 Mon Sep 17 00:00:00 2001 From: avinashtrivedix Date: Sun, 18 Oct 2026 13:09:04 +0530 Subject: [PATCH 3/3] Remaining flake8 whitespace on 313 and 315 --- feature_engine/encoding/one_hot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature_engine/encoding/one_hot.py b/feature_engine/encoding/one_hot.py index 2fe29316e..46032711c 100644 --- a/feature_engine/encoding/one_hot.py +++ b/feature_engine/encoding/one_hot.py @@ -310,6 +310,5 @@ def _add_new_feature_names(self, feature_names) -> List: """Adds new features to df columns, and removes categoricals.""" feature_names = [f for f in feature_names if f not in self.variables_] feature_names = feature_names + self._get_new_features_name() - + return feature_names - \ No newline at end of file