Registry / ai-ml / missingpy

missingpy

JSON →
library0.2.0pypypiunverified

MissingPy is a Python library providing tools for missing data imputation, offering an API consistent with scikit-learn. It primarily supports k-Nearest Neighbors (KNNImputer) and Random Forest-based (MissForest) imputation algorithms. The current version is 0.2.0, released in December 2018. Due to infrequent updates since its last release and limited recent activity on its GitHub repository, the library is considered to be in a maintenance state, with no active development or new releases anticipated.

pip install missingpy
INSTALL
IMPORT
SIG · MISSINGPY
M
missingpy
ai-mlpythonv0.2.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KNNImputer
from missingpy import KNNImputer
from missingpy import KNNImputer

This quickstart demonstrates how to use `MissForest` to impute missing values (represented by `np.nan`) in a NumPy array. It includes the necessary workaround for `scikit-learn` compatibility that is commonly required. Ensure categorical variables are one-hot encoded before passing them to the imputer.

import numpy as np # Workaround for scikit-learn compatibility import sklearn.neighbors._base import sys sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base from missingpy import MissForest nan = np.nan X = np.array([ [1, 2, nan], [3, 4, 3], [nan, 6, 5], [8, 8, 7] ]) imputer = MissForest(random_state=42) X_imputed = imputer.fit_transform(X) print("Original Data with NaNs:\n", X) print("Imputed Data:\n", X_imputed)
Debug
Known issues
breakingMissingPy has severe compatibility issues with recent versions of `scikit-learn` (e.g., >=1.0) due to reliance on internal `sklearn.neighbors` modules that have been reorganized or removed. This often leads to `ImportError`.
fix
Use a compatibility workaround by aliasing `sys.modules['sklearn.neighbors.base']` before importing `missingpy` classes. Additionally, pinning `scikit-learn` to an older, compatible version (e.g., `scikit-learn==1.1.2` or lower) and `scipy==1.9.1` is often required.
affects: missingpy==0.2.0 with scikit-learn >= 1.0
gotchaMissingPy's `MissForest` algorithm expects numerical input. If your dataset contains categorical variables, they must be explicitly one-hot encoded (dummy encoded) before passing them to the imputer, otherwise, it will raise an error like 'could not convert string to float'.
fix
Manually one-hot encode categorical columns using `pandas.get_dummies` or `sklearn.preprocessing.OneHotEncoder` before imputation.
affects: All versions
gotchaThe `missingpy` library is no longer actively maintained. The last PyPI release was in December 2018, and the GitHub repository shows minimal activity since. This means there will likely be no official updates for newer Python versions, `scikit-learn` compatibility, or bug fixes.
fix
Be aware of potential future incompatibilities with newer Python ecosystem libraries. Consider alternative, actively maintained imputation libraries for long-term projects.
affects: All versions (due to lack of future updates)
Upgrade
Version history
0.2.0latest on PyPI · released Dec 10, 2018
Audit
Dependencies
numpyrequiredFundamental array operations and data structures.
scipyrequiredScientific computing and advanced mathematical operations.
scikit-learnrequiredAPI compatibility and underlying machine learning utilities.
pandasrequiredData manipulation, especially for handling DataFrames.
Agent activity
22 hits · last 30 days
node
22
Resources
missingpy — pip install missingpy · libregistry