Skip to main content

Universal Data Cleaner

CI Docs PyPI Python 3.10+ License: MIT Managed with uv

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

Full 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, IQR capping, and exact int64 preservation with explicit precision-loss policies
  • 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
  • CleanerReport combining profile, contract drift, validation, ingestion, and cleaner decisions, plus a data-cleaner audit CLI
  • declarative contracts with roles, allowed values, ranges, patterns, and uniqueness
  • automatic train-schema contract inference, transform-time drift reports, and transform_with_report() for concurrency-safe batch reporting
  • 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 with atomic writes, manifests, runtime compatibility checks, and stable data fingerprints
  • scikit-learn Pipeline, clone, and get_feature_names_out compatibility
  • 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.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for universal-data-cleaner 2.10.0
File Size Uploaded Provenance Actions
universal_data_cleaner-2.10.0.tar.gz 88.0 kB With provenance Details for universal_data_cleaner-2.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for universal-data-cleaner 2.10.0
File Interpreter ABI Platform Actions
universal_data_cleaner-2.10.0-py3-none-any.whl Python 3 none any Details for universal_data_cleaner-2.10.0-py3-none-any.whl

Total release size: 158.3 kB

Release files / universal_data_cleaner-2.10.0.tar.gz

Download URL universal_data_cleaner-2.10.0.tar.gz
Size 88.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb95624910356f212b64425c11823df37f9ab2daed98098aaebc942490cec52
BLAKE2b-256 checksum
How to use checksums
7c90d21c2a3e20a8dae134a957cb22edf44582ffe97dc75055363890b033f1ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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 12, 2026.

Transparency log

Release files / universal_data_cleaner-2.10.0-py3-none-any.whl

Download URL universal_data_cleaner-2.10.0-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
602e6e60cd96fc98a067385e5e59cc019a9fd8a783ea9dc7107e6171fd39c5ff
BLAKE2b-256 checksum
How to use checksums
8d0acef2573a519352c1dd6e04de6c36c935396dbe8d6dfaf8306c73137c6ea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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 12, 2026.

Transparency log

Security for universal-data-cleaner 2.10.0

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.

Select from 2 files

Attestation for universal_data_cleaner-2.10.0.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 12, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page