Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d090224
update dt functions
solegalli Jan 28, 2026
6ff27aa
expand tests
solegalli Jan 28, 2026
9d44303
expand tests
solegalli Jan 28, 2026
de4d663
update fpr new pandas behaviour
solegalli Jan 28, 2026
da5ff67
fix: Pandas 3 compatibility - robust dtype checks and test fixes
ankitlade12 Jan 28, 2026
e0c3292
fix: Remove whitespace before colon in slice notation (flake8 E203)
ankitlade12 Jan 28, 2026
ccbfa05
feat: finalize Pandas 3 compatibility fixes and test updates
ankitlade12 Jan 28, 2026
fd43124
style: fix flake8 line length and linting issues
ankitlade12 Jan 28, 2026
8367d4a
style: fix remaining flake8 C416 issue
ankitlade12 Jan 28, 2026
3225500
Fix Pandas 3 regressions in check_y, _check_contains_inf, and StringS…
ankitlade12 Jan 28, 2026
bde0b9b
Fix E501 line too long in dataframe_checks.py
ankitlade12 Jan 28, 2026
dedf500
Fix StringSimilarityEncoder NaN issues and fragile test assertions
ankitlade12 Jan 28, 2026
765e102
fix: Pandas 3 stability - mock datasets and fix FutureWarnings
ankitlade12 Jan 28, 2026
28894c5
style: fix flake8 linting errors E501, E302, E305, SIM102
ankitlade12 Jan 28, 2026
08821a6
test: improve patch coverage for Pandas 3 stability fixes
ankitlade12 Jan 28, 2026
972a4b7
style: fix E501 line too long in similarity encoder tests
ankitlade12 Jan 28, 2026
0fb27cb
fix: correct missing indicator creation in AddMissingIndicator class
mo1998 Feb 1, 2026
6c41b96
Merge branch 'pr-885-pandas3'
mo1998 Feb 2, 2026
4ef16d0
Revert "Merge branch 'pr-885-pandas3'"
mo1998 Feb 3, 2026
2171550
test: add performance warning check for AddMissingIndicator with many…
mo1998 Feb 3, 2026
1d03ca0
refactor: optimize missing indicator creation and improve performance…
mo1998 Feb 4, 2026
bb813fd
fix style issues (trailing whitespace, blank lines, and missing EOF n…
mo1998 Feb 4, 2026
4b11c04
reorder test imports
solegalli Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions feature_engine/imputation/missing_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ def transform(self, X: pd.DataFrame) -> pd.DataFrame:
"""

X = self._transform(X)

indicator_names = [f"{feature}_na" for feature in self.variables_]
X[indicator_names] = X[self.variables_].isna().astype(int)
X_indicators = (
X[self.variables_]
.isna()
.astype("int8")
.add_suffix("_na")
)
X = pd.concat([X, X_indicators], axis=1)

return X

Expand Down
27 changes: 27 additions & 0 deletions tests/test_imputation/test_missing_indicator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import warnings
import numpy as np
import pandas as pd
import pytest

from sklearn.pipeline import Pipeline

from feature_engine.imputation import AddMissingIndicator
Expand Down Expand Up @@ -96,3 +100,26 @@ def test_get_feature_names_out_from_pipeline(df_na):

assert tr.get_feature_names_out(input_features=None) == feat_out
assert tr.get_feature_names_out(input_features=original_features) == feat_out


def test_no_performance_warning_with_many_variables():
n_cols = 101
df = pd.DataFrame(
np.random.randn(10, n_cols),
columns=[f"col_{i}" for i in range(n_cols)],
)

# Introduce missing values
df.iloc[0, :] = np.nan

ami = AddMissingIndicator(missing_only=False)
ami.fit(df)

with warnings.catch_warnings(record=True) as captured:
warnings.simplefilter("always")
ami.transform(df)

assert not any(
issubclass(w.category, pd.errors.PerformanceWarning)
for w in captured
), "PerformanceWarning was raised during transform"