Universal Data Cleaner
A small, production-oriented tabular cleaning transformer for pandas + scikit-learn.
It is designed for the part of an ML pipeline that is easy to get wrong: cleaning training data and inference data with exactly the same learned rules.
Documentation
The docs site is the central reference. This README is the short entry point.
| Guide | What it covers |
|---|---|
| Quickstart | Install, first cleaner, scikit-learn pipeline |
| Leak-safe workflow | The fit/transform contract and common mistakes |
| Cleaning data | Config, roles, imputation, outliers, datetimes |
| Contracts & drift | ColumnSpec, DataContract, drift checks |
| Safe ingestion | Contract-driven CSV and Excel reads with ingestion reports |
| Batch reporting | CleanerReport and the data-cleaner audit CLI |
| Validation, joins & dedup | Expectations, join diagnostics, integrity, dedup |
| ML split audit | Duplicate, group, temporal, and target leakage |
| Artifacts & reproducibility | Decision log, manifests, fingerprints, save/load |
| Production guide | Deployment checklist and failure modes |
| API reference | Generated from the package docstrings |
| Changelog | Release notes |
| Upcoming | What ships next and what is out of scope |
Install
pip install universal-data-cleaner
uv add universal-data-cleaner
The distribution name is universal-data-cleaner; the import name is
data_cleaner.
For Excel input, install the optional extra:
pip install "universal-data-cleaner[excel]"
uv add "universal-data-cleaner[excel]"
from data_cleaner import CleanerConfig, DataCleaner
Quick start
import pandas as pd
from data_cleaner import CleanerConfig, DataCleaner
train = pd.DataFrame(
{
"age": [34, 41, None, 29],
"salary": [70_000, 82_000, 91_000, 55_000],
"dept": ["IT", "HR", "IT", None],
"joined": ["2022-01-03", "2021-11-20", "2023-04-01", "bad-date"],
}
)
config = CleanerConfig(
datetime_columns=("joined",),
add_missing_indicators=True,
drop_constant_columns=True,
)
cleaner = DataCleaner(config).fit(train)
train_clean = cleaner.transform(train)
fit() learns medians, modes, outlier bounds, category values, and datetime
rules from train. transform() applies those stored rules without learning
from the frame you pass in.
Leak-safe by construction
cleaner = DataCleaner(config).fit(X_train)
X_train_clean = cleaner.transform(X_train)
X_test_clean = cleaner.transform(X_test) # training rules only
Never fit before splitting, and never create a new cleaner for test or production data. See the leak-safe workflow for the full explanation.
What it handles
- numeric coercion, median / mean / constant imputation, and IQR capping
- categorical mode / constant imputation and a keep-or-fill unseen policy
- boolean coercion and imputation
- datetime parsing plus calendar feature extraction
- optional missing-value indicators and constant-column dropping
- safe CSV and Excel ingestion with contract-driven coercion, identifier protection, date and boolean guards, and an audit report
CleanerReportcombining profile, contract drift, validation, ingestion, and cleaner decisions, plus adata-cleaner auditCLI- declarative contracts with roles, allowed values, ranges, patterns, and uniqueness
- automatic train-schema contract inference and transform-time drift reports
- expectation checks and validation reports
- join diagnostics, referential integrity, and audited business-key dedup
- train/test split audits for duplicate, group, temporal, and target leakage
- joblib save / load, manifests, and stable data fingerprints
- scikit-learn
Pipeline,clone, andget_feature_names_outcompatibility - stable output schema and column order; inputs are never mutated and inference rows are never dropped
Development
git clone https://github.com/devlprkhan/universal-data-cleaner.git
cd universal-data-cleaner
uv sync --dev
uv run pytest -q
Run the full quality gate:
uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run pytest
uv build
Build or preview the docs:
uv sync --group docs
uv run --group docs mkdocs serve
uv run --group docs mkdocs build --strict
The reference notebook is Universal_Data_Cleaner.ipynb. Open it with:
uv run jupyter lab Universal_Data_Cleaner.ipynb
Project layout
src/data_cleaner/ # typed, pip-installable package
tests/ # unit and integration tests
docs/ # MkDocs guides, API page, and assets
mkdocs.yml # documentation site configuration
Universal_Data_Cleaner.ipynb # end-to-end reference workflow
pyproject.toml # package metadata and tooling
uv.lock # reproducible dependency lock
CHANGELOG.md # release notes
CONTRIBUTING.md # development workflow
SECURITY.md # vulnerability reporting
LICENSE # MIT license
The package ships a py.typed marker, so mypy, pyright, and IDE tooling pick
up the type annotations automatically. Linting, formatting, type checking, tests,
the docs build, and package build run in CI.
Contributing
Contributions are welcome. See CONTRIBUTING.md for the local setup, quality gate, and pull-request expectations.
License
Released under the MIT License.
Metadata
Release files for universal-data-cleaner 2.9.1
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 |
|---|---|---|---|---|
| universal_data_cleaner-2.9.1.tar.gz | 81.7 kB | With provenance | Details for universal_data_cleaner-2.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| universal_data_cleaner-2.9.1-py3-none-any.whl | Python 3 | none | any | Details for universal_data_cleaner-2.9.1-py3-none-any.whl |
Total release size: 147.4 kB
Release files / universal_data_cleaner-2.9.1.tar.gz
| Download URL | universal_data_cleaner-2.9.1.tar.gz |
|---|---|
| Size | 81.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7c50cb1f3fb47539f170f697c64066e91cd4d4fa44b2a889c9320fd609ba061
|
|
BLAKE2b-256 checksum How to use checksums |
a42bf3ab3c3b70145355daae4d525f74615b9631c56873bf0142d1e54275b5a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / universal_data_cleaner-2.9.1-py3-none-any.whl
| Download URL | universal_data_cleaner-2.9.1-py3-none-any.whl |
|---|---|
| Size | 65.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d02a1fb26598c99a594617c371fde7968a5cced18324ecae3d53b1dc366a28df
|
|
BLAKE2b-256 checksum How to use checksums |
2f34466487fc023877ae5b38bc601387d0043e48629fb9a30491f0993eaae819
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for universal-data-cleaner 2.9.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for universal_data_cleaner-2.9.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA 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.