📦 NullPy
An Intelligent, Data-Aware Pandas DataFrame Cleaner 🚀
NullPy is a Python library for automatic, intelligent, and target-aware cleaning of pandas DataFrames.
It handles missing values, outliers, and predictive imputations using ML models when needed.
No more repetitive manual cleaning — NullPy decides the best strategy automatically.
✨ Features
-
🧹 Automatic Missing Value Handling
- Detects missing values.
- Decides best imputation strategy (
mean,median,mode,predictive). - Can train ML models (
RandomForest,LinearRegression,LogisticRegression) for predictive imputation.
-
📊 Outlier Detection & Handling
- Detects outliers using IQR method.
- Handles them via clip, drop, or predictive imputation.
-
🎯 Target-Aware Cleaning
- Uses correlation & chi-squared tests to decide when predictive cleaning is useful.
-
⚡ Highly Customizable
- Parameters for imputation strategy, outlier strategy, verbosity, and difference reporting.
-
🖥️ Beautiful Console Output (powered by Rich)
- Colorful progress bars.
- Summary cleaning reports.
- Difference reports (before vs after cleaning).
-
🔮 Demo Reports Included
- Quick one-call demo for showing cleaning in action.
🚀 Installation
pip install pandas numpy scikit-learn rich
(Or clone the repo and drop nullpy.py into your project.)
⚡ Quick Usage
1️⃣ Basic Cleaning
import pandas as pd
from nullpy import SmartDFCleaner
# Example Data
data = {
'Age': [25, 30, None, 22, 35, 45, 28, 33, None, 50, 150],
'Income': [50000, 60000, 58000, None, 72000, 68000, 52000, 61000, 59000, 75000, 80000],
'Gender': ['Male', 'Female', 'Male', 'Female', 'Male', None, 'Female', 'Male', 'Male', 'Female', 'Male'],
'City': ['NY', 'LA', 'NY', 'SF', 'LA', 'NY', 'SF', 'LA', 'NY', 'SF', 'LA'],
'Purchased': [0, 1, 1, 0, 1, 1, 0, 1, None, 1, 0]
}
df = pd.DataFrame(data)
# Run cleaner
cleaner = SmartDFCleaner(target_column="Purchased", show_difference=True)
cleaned_df = cleaner.fit_transform(df)
print(cleaned_df)
2️⃣ One-Call Full Demo (with auto + predictive cleaning reports)
from nullpy import SmartDFCleaner
newdf = SmartDFCleaner().clean_it(df, target_column="Purchased")
This will:
- Show original data.
- Show auto-cleaned DataFrame.
- Show predictive-cleaned DataFrame.
- Print summary reports + null counts.
⚙️ Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
target_column |
str | None | Target variable for correlation/predictive imputation |
impute_strategy |
str | auto |
auto, mean, median, mode, predictive |
outlier_strategy |
str | auto |
auto, clip, drop, predictive |
verbose |
bool | True | Print logs and progress |
show_difference |
bool | False | Show before/after difference report |
📊 Example Console Output
> Identified 2 numerical and 2 categorical features.
> 'Age' has high missing data (18.0%). Using simple imputation.
> Applied Median Imputation to column 'Age'.
> Clipped 1 outliers in column 'Age'.
> Cleaning process completed successfully!
🛠️ Methods
fit_transform(df)→ Returns cleaned DataFrame.demo_report(df, target_column, ...)→ Runs auto + predictive cleaning demo.clean_it(df, target_column, ...)→ One-call shortcut for full demo + final cleaned DF.
📌 Roadmap
- 🔜 Add support for time-series cleaning.
- 🔜 Add advanced outlier detection (Isolation Forest, Z-score).
- 🔜 Export cleaning logs to JSON/CSV.
👨💻 Author
Made with ❤️ and ☕ by Foresty (India 🇮🇳)
Metadata
Release files for nullpy 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nullpy-0.0.2.tar.gz | 10.6 kB | Without provenance | Details for nullpy-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nullpy-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for nullpy-0.0.2-py3-none-any.whl |
Total release size: 19.9 kB
Release files / nullpy-0.0.2.tar.gz
| Download URL | nullpy-0.0.2.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e66f3e347f2cfb027d4c04d01cb8b912e0ff93e9254c8396a5e3a83ce8061de
|
|
BLAKE2b-256 checksum How to use checksums |
0b087b740aee0ab24eba88573107593f39a4d6750a5f44bfe64b65618ca54e23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Release files / nullpy-0.0.2-py3-none-any.whl
| Download URL | nullpy-0.0.2-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a28f1f87e39db6efdf35f2292aee2fa7454ffd53ddb821c41c0099018bb3b477
|
|
BLAKE2b-256 checksum How to use checksums |
009a06a8d2a3a72fba946ac7efd10ee876524fa5a888ec707b67ab9ab68099be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Security for nullpy 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.