Clean messy real-world datasets with safe, explainable defaults before ML.
Project description
datacleaner
Clean messy real-world datasets with safe, explainable defaults before ML.
Overview
datacleaner is a practical data-cleaning library for tabular datasets in pandas. It is designed for ML practitioners, students, and data engineers who need a reliable baseline cleaning pipeline. The library emphasizes safety, transparent decisions, and clear diagnostics so you can inspect what changed and why.
Key Features
- Missing value handling with smart fill and high-missing column dropping.
- Duplicate removal for exact duplicate rows.
- Datatype correction with numeric and datetime detection.
- Text standardization (lowercase, trim, and common value normalization).
- Outlier handling with
caporremovemodes, plus capping diagnostics. - Column selection for constant columns and likely ID-like columns.
- Correlation reduction for highly correlated numeric features.
- Safety mode to prevent excessive row or column loss.
- Structured diagnostics reporting for explainable cleaning.
Quick Start
Minimal usage:
from datacleaner import clean
df = clean(df)
Advanced usage with report and verbose logs:
from datacleaner import clean
df, report = clean(df, return_report=True, verbose=True)
Example Output
Missing values: dropped 1 columns, filled 99 values.
Duplicates: removed 5 rows.
Outliers (cap): capped 12 values.
Column selection: dropped 1 low-information columns.
Diagnostics:
- numeric_candidate_columns: ['mixed_numeric']
- max_correlation: 0.48
- high_outlier_capping_columns: []
Diagnostics and Safety
numeric_candidatedetection highlights text columns that are mostly numeric-like.- Outlier diagnostics flag columns with high capping rates to avoid silent over-correction.
- Correlation diagnostics report max observed correlation and number of pairs checked.
safe_mode=Truewarns when data loss is high and can roll back aggressive steps.
When to Use / When Not to Use
Use datacleaner when:
- You are working with messy real-world tabular datasets.
- You need a quick, safe baseline cleaning pass before modeling.
Do not use datacleaner when:
- You need full ML preprocessing (for example scaling, encoding, or feature engineering).
- Your workflow requires domain-specific cleaning rules that cannot be generalized.
Installation
pip install datacleaner
Testing
The library has been validated using:
- synthetic stress tests
- sklearn datasets
- edge-case scenarios
Run tests:
python tests/test_sklearn_datasets.py
Project Structure
datacleaner/
src/datacleaner/
core.py
analysis.py
missing_values.py
duplicates.py
datatypes.py
text_standardization.py
outliers.py
column_selection.py
correlation_reduction.py
reporting.py
tests/
examples/
Contributing
Contributions are welcome. Please open an issue for bug reports or design proposals, and submit a pull request for fixes and improvements.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datacleanr-0.1.1.tar.gz.
File metadata
- Download URL: datacleanr-0.1.1.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7506f3e31e10f2d6b4424b2596fe0f64da39fe6563219db35ca5835153ef449b
|
|
| MD5 |
dc4a7c8ebe1ccda130fe275ca2804a56
|
|
| BLAKE2b-256 |
e4b71e7caaa811aa45252835a1220376c114b08455a7ec8153bbe2416beaa38c
|
File details
Details for the file datacleanr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: datacleanr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd87ce230077eaacae6d1b4071dfc9addc2b894545f54d250796e464961db8ca
|
|
| MD5 |
36a163162f5c58e5a0c20252d4c12422
|
|
| BLAKE2b-256 |
f036ee0bf5ccb69216f6755af5b83d4dd06b28b3c6607a7aa4a3975488053d42
|