Changelog¶
All notable changes to this project are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased¶
0.2.0 - 2026-09-16¶
A consistent API: one name per concept, an explicit choice when a model fails, and
one policy for empty columns and output dtypes across all 42 imputers. Old names
keep working, with a FutureWarning, until 1.0.0.
Added¶
on_errorparameter on the imputers whose model can fail to fit (MICEImputer,MissForestImputer,KNNImputer,RadiusNeighborsImputer,RegressionImputer,PMMImputer,GaussianProcessImputer,RANSACImputer,SoftImputeImputer,PPCAImputer,AutoencoderImputer) and on their shortcuts:on_error="raise"raises the newImputationError(aRuntimeError), chained to the underlying error.on_error="fallback"uses mean or median imputation instead, as before, and logs a warning.
Changed¶
- Consistent parameter names across imputers, following scikit-learn conventions:
max_iterfor iteration budgets:SoftImputeImputer(max_iters=...)andGAINImputer(iterations=...)are nowmax_iter=....n_neighborsfor neighbor and donor counts:KNNImputer(k=...)andPMMImputer(k=...)are nown_neighbors=....n_stdfor the number of standard deviations inEndOfDistributionImputer(k=...).strategyfor the summary statistic inGroupMeanImputer,MovingAverageImputerandSeasonalImputer, which usedmethod=....InterpolationImputer(method=...)is unchanged; there it selects the interpolation kind, as in pandas.- The functional shortcuts follow the same names.
- Renamed
KNNImputerMethodtoKNNImputer,BayesianPCAImputertoPPCAImputer(it is maximum-likelihood probabilistic PCA),predictive_mean_matchingtopmm_imputeandbayesian_pca_imputetoppca_impute. - Instance attributes use the new parameter names (e.g.
imputer.n_neighbors). - One output dtype policy for every imputer. Columns without missing values are
returned unchanged, with the same dtype; imputed columns are floating point,
keeping
float32orfloat64, and pandas nullable columns becomeFloat64so values that couldn't be imputed stay<NA>. Previously the imputers based on scikit-learn (KNNImputer,MICEImputer,MissForestImputer,EMImputer,SoftImputeImputer,PPCAImputer,GAINImputer) turned every column, including complete integer columns, intofloat64. - Behavior change: a column with no observed values is now left as
NaNby every imputer that learns from the data.BayesianRidgeImputer,HuberImputer,LocalMeanImputerandHybridImputerused to fill it with 0, andAutoencoderImputerwith values reconstructed from 0.HybridImputertherefore no longer guarantees a result withoutNaNwhen a column is entirely empty; addConstantImputerto itsmethodsto fill such columns with a fixed value.
Deprecated¶
- The old class, function and parameter names above still work but emit a
FutureWarningstarting withimputation-methods:, and will be removed in 1.0.0. Run your code with-W "error:imputation-methods:FutureWarning"to find uses. - Falling back to a simpler method without asking. When a model fails and
on_errorisn't set, the imputer still falls back but now emits aFutureWarning; the default will becomeon_error="raise"in 1.0.0. Unexpected errors that previously raised a plainRuntimeErrornow raiseImputationError, a subclass.
Fixed¶
- 24 imputers raised
TypeErroron pandas nullable integer columns (Int64) with missing values, andKalmanFilterImputerandLocalMeanImputeron other nullable columns;float32columns with missing values failed in 7 imputers under pandas 3. TrimmedMeanImputeremitted a SciPySmallSampleWarning, andMedianImputer,ModeImputer,IndicatorImputer,GroupMeanImputerandColdDeckImputera NumPy "Mean of empty slice" warning on older NumPy, for columns with no observed values.
0.1.0 - 2026-09-16¶
First release on PyPI, as imputation-methods.
Added¶
- 42 imputers behind one interface,
BaseImputer.impute(df) -> DataFrame: - Statistical:
MeanImputer,MedianImputer,ModeImputer,ConstantImputer,QuantileImputer,TrimmedMeanImputer,EndOfDistributionImputer,GroupMeanImputer,IndicatorImputer - Donor sampling:
RandomSamplingImputer,HotDeckImputer,ColdDeckImputer - Time series:
LOCFImputer,NOCBImputer,ForwardFillFallbackImputer,InterpolationImputer,MovingAverageImputer,WeightedMovingAverageImputer,LinearTrendImputer,PolynomialTrendImputer,SeasonalImputer,KalmanFilterImputer - Nearest neighbors:
KNNImputerMethod,RadiusNeighborsImputer,LocalMeanImputer - Regression:
RegressionImputer,StochasticRegressionImputer,PMMImputer,BayesianRidgeImputer,HuberImputer,RANSACImputer,GaussianProcessImputer - Iterative:
MICEImputer,EMImputer,MissForestImputer - Matrix completion:
SoftImputeImputer,BayesianPCAImputer - Neural networks:
AutoencoderImputer,GAINImputer - Ensembles:
HybridImputer,StackingImputer,BaggingImputer - A functional shortcut for every imputer, e.g.
knn_impute(df, k=3), accepting the same parameters and defaults as its class. rmseandmaemetrics for scoring imputations against ground truth.- Inline type hints (
py.typed), checked with mypy in strict mode. - Documentation site with an API reference generated from docstrings.
Changed¶
- Renamed the project from
imputation-showcasetoimputation-methodsand moved the code to asrc/layout split into submodules. Import everything from the top-level package:from imputation_methods import MeanImputer. SoftImputeImputerandBayesianPCAImputerare now implemented directly on NumPy, replacing the unmaintainedfancyimputeandppcadependencies.fancyimpute0.7.0 no longer worked with scikit-learn 1.8+, and it pulledpytest,nose,cvxpyandcvxoptin as runtime dependencies. Both imputers are now deterministic and gained validatedshrinkage_value/convergence_thresholdandmax_iter/toloptions respectively.- Runtime dependencies are now just NumPy (>=1.24), pandas (>=2.0, including 3.x),
SciPy (>=1.10) and scikit-learn (>=1.4). Matplotlib and seaborn moved to the
optional
vizextra. - Handled fallbacks (e.g. MICE falling back to mean imputation) log a single
WARNINGinstead ofERROR+WARNING, and routine progress messages were removed fromINFO. GAINImputernow implements Generative Adversarial Imputation Nets (Yoon et al., 2018) on NumPy, with the reference hyperparameters (batch_size,hint_rate,alpha,iterations,learning_rate). It previously ran scikit-learn'sIterativeImputerand gave the same results asMICEImputer.BaggingImputernow performs real bootstrap aggregating: each run imputes a resampled set of rows (max_samples) with its own seed, and the results are averaged. It previously averaged identical runs on the full data.ColdDeckImputeracceptsrandom_statefor reproducible sampling from array reference values.- Faster, vectorized
GroupMeanImputerandSeasonalImputer.
Fixed¶
StochasticRegressionImputerraisedValueErrorwhenever more than one column had missing values;RegressionImputer,PMMImputerandGaussianProcessImputersilently fell back to mean imputation in the same situation. Gaps in predictor columns are now mean-filled before fitting.- A column with no observed values made
EMImputerraise, and madeMICEImputer,MissForestImputerandKNNImputerMethodfall back to mean/median imputation for every column. Such columns are now left asNaNand the other columns are imputed normally. PMMImputerdrew donors with the same seed for every missing value, and filled columns with no observed values with 0.- Time-series imputers used
fillna(method=...), which was removed in pandas 3. HotDeckImputertriggered a pandas 4 deprecation warning when stratifying by a single column.- Docstring examples that used non-existent arguments (e.g.
n_neighbors=). AutoencoderImputertriggered a scikit-learnDataConversionWarningon single-column input.