Repository navigation
Releases
v2.12.0 — Validation rules and statistical drift
2.12.0 is the validation and statistical-drift release. It adds a composable rule layer on top of the existing validation report, reference-versus-current drift comparison, bounded failing-row diagnostics, and an append-only report sink for batch history.
Added
- Statistical drift:
DriftPolicy,DriftProfile,DistributionDriftReport, andcompare_distributions()compare a current batch against a stored reference using population stability index (PSI), an approximate 1-D Wasserstein distance plus a scale-free ratio, missingness deltas, and category share deltas. Levels outside the retained reference categories are aggregated into anotherbucket. Numeric and datetime columns are supported; booleans compare as categorical. - Documented thresholds: PSI
0.10warning /0.25error,5pp missingness warning,10pp category warning, an optional Wasserstein ratio threshold, andmin_sample=20, which downgrades errors to warnings on small batches. Thresholds must be finite and non-negative, counts must be integers, and policies serialize to and from JSON. - Portable profiles:
DriftProfile.from_frame()keeps a bounded, JSON-serializable summary (bin edges, shares, scales, 512 midpoint quantiles per numeric column, and the top 20 levels per categorical column) instead of a sorted raw column.to_json()/from_json()round-trip the profile and its policy, and the defaultrepris redacted. - Composable rules:
col()conditions with explicit.eq,.ne,.lt,.le,.gt,.ge,.isin,.not_in,.between,.isna,.notna, and.matchesmethods;&,|, and~composition;row_rule()for cross-column predicates;conditional()for scoped rules;grouped()for per-group checks;unique_combination(); andsum_equals(). Comparisons skip missing operands, so nulls do not fail a predicate unless it asks for them with.isna(). - Public
Validatableprotocol:validate()accepts expectations, rules, custom objects withname,column,severity, andcheck(frame), and mixed lists. A custom rule may return severalValidationResultobjects from one check. - Bounded diagnostics:
ValidationReport.diagnose(frame, limit=5, include_values=False, include_index=True, max_value_length=32)samples failing rows asRowDiagnostics— bounded per failing rule, value-free by default, truncated values when enabled, and only failing frame-level or grouped rules listed inskipped. - Batch history:
JsonlReportSinkappendsCleanerReport,DistributionDriftReport, or mapping records to a JSON Lines file, reads them back in order, summarizes history, and exposesdrift_against_previous(), which reuses the stored reference profile and policy for a reproducible comparison.
Changed
ValidationReportgainssourcesandfrom_results(..., sources=...)so diagnostics can attribute failures. Reports built from contract findings have no sources and produce an empty diagnostic sample.- JSON-safe conversion is shared by reporting, drift, and sinks; drift profiles and reports serialize NaN and infinity as
nulland leak no non-standard JSON literals. DriftProfilerequires a non-empty reference and current frame with unique string column labels, reports missing or kind-changed columns as errors with metrics skipped, and never mutates the caller's frames.sum_equals()fails rows with present non-numeric components or targets instead of silently skipping them, andJsonlReportSinkreads records withsplit("\n")so Unicode line separators in metadata cannot corrupt history.
Integration boundary
This release integrates with Pandera, Feature-engine, and Evidently rather than rebuilding them: rules and drift operate on plain pandas frames, so existing contract and monitoring stacks can keep their own semantics.
Documentation
- Statistical drift — policies, thresholds, profiles, sinks, and privacy notes.
- Validation, joins & dedup — rules, custom
Validatableobjects, and diagnostics. - API reference — full signatures.
Compatibility
Python 3.10–3.13, pandas 2.x and 3.x. No new runtime dependencies.
Full changelog: https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
v2.11.0 — Large data and performance
Phase 2 of the roadmap: scale behavior is now measured, reproduced, and
documented before any claim is made about it.
Install
pip install universal-data-cleaner==2.11.0
# Parquet support
pip install "universal-data-cleaner[parquet]==2.11.0"Benchmark suite
benchmarks/run_benchmarks.py measures seven operations separately (ingest, fit,
transform, transform_with_report, transform_chunks, contract_check, validate)
across narrow, wide, and high-cardinality frames — 42 cases up to 2M rows.
- Each case runs in a fresh subprocess; runtime (
perf_counter, min of repeats,
no tracing) and peak memory (tracemallocaftergc.collect()) are measured in
separate phases. - Workloads are seeded and vectorized, so runs are reproducible.
- The JSON records library/Python/pandas/NumPy/scikit-learn versions, platform,
CPU count, and git commit, and is checkpointed after every case. - CI now runs a 10K-row smoke matrix, required by
ci-success.
Reference run: benchmarks/results/2.11.0-darwin-x86_64.json
(Python 3.13.5 x86_64, pandas 3.0.6, NumPy 2.5.4, scikit-learn 1.9.1, 16 logical CPUs).
New API
DataCleaner.transform_chunks(chunks)yields(cleaned, DriftReport)per chunk
without touching shared instance state, keeping one chunk in memory.combine_drift_reports(reports)rolls chunk reports into aTransformReport
with summed rows, chunk count, and concatenated findings, exposing the same
has_drift/errors/warnings/summary()/raise_if_errors()surface
asDriftReport.DriftReport.rowsrecords the batch size.read_parquet_safe()anditer_parquet_safe()add optional Parquet ingestion
(newparquetextra,pyarrow>=14) with the same contract audit, cross-batch
uniqueness tracking, and report aggregation as the CSV readers.
Changed
transform()no longer deep-copies its input and skips redundant column
selection and reindexing when the frame already matches the fitted schema. The
no-mutation guarantee is unchanged and covered by tests.docs/performance.mddocuments the methodology, the full measured matrix, the
sizing rule derived from it, and an explicit "what is not measured" section.
Measured highlights
| Workload | Result |
|---|---|
| Fit + transform, 2M rows × 10 columns | 7.7 s + 2.3 s, 620 MB traced peak |
| Fit + transform, 100K rows × 120 columns | 2.5 s + 1.1 s, 241 MB traced peak |
| Contract check + validate, 2M rows | 0.22 s + 0.06 s |
| Ingest 20M cells (2M × 10 CSV) | 123 s, 725 MB traced peak |
| Chunked transform, 8 chunks, 2M rows | same runtime, 5.8× lower traced peak |
Ingestion is cell-bound at ~150K cells/s and is the operation that decides whether
a single-batch workflow fits; transform holds 8.6–11M cells/s.
Verification
All CI jobs passed on PR #45: lint, typecheck, tests on Python 3.10–3.13, compat
(minimum / latest / pandas 3), build, installed wheel, docs, benchmark smoke, and
ci-success. Provenance verification for this release is recorded in the follow-up
documentation commit.
v2.10.0 — Production correctness
Universal Data Cleaner 2.10.0
Production-correctness release. No new data-cleaning primitive; this version hardens the existing surface.
Concurrency-safe reporting
DataCleaner.transform_with_report(X)returns(cleaned_frame, DriftReport)for one batch without reading or writing shared state.transform()stays backward compatible and documentsdrift_report_as per-instance last-call state.
Numeric precision
CleanerConfig.preserve_integer_dtypes=Truekeeps integral columns asint64when the learned fill value and outlier bounds are integral.CleanerConfig.on_precision_losssupports"coerce","warn", and"raise".- Detection is exact at the
2^53boundary: representable values such as2^53 + 2stay intact, while2^53 + 1is flagged.
Artifact persistence
save()writes to a temporary file, validates it, then atomically replaces the target withos.replace. Failed saves keep the previous artifact and remove partial files.load(..., strict_environment=True)turns pandas, NumPy, or scikit-learn major-version mismatches intoArtifactCompatibilityError; the default logs a warning.- Corrupt and truncated artifacts now raise
ValueErrorwith the underlying cause.
Chunked ingestion
iter_csv_safe()gainsunique_tracking("memory","disk", or"auto"),unique_tracking_limit, andunique_tracking_path.- Disk tracking uses SQLite;
"auto"migrates from memory once the limit is exceeded. combine_ingestion_reports(reports, source=None)rolls per-chunk reports into one whole-file report.
Documentation
- Updated cleaning, ingestion, production, artifact, API, README, changelog, and roadmap documentation.
Verification
- Local gate: ruff, formatting, mypy, pytest, wheel/sdist build, and strict MkDocs build.
- CI: lint, typecheck, tests on Python 3.10–3.13, compatibility on minimum/latest dependencies and pandas 3.x, build, installed-wheel smoke test, docs, and
ci-success.
Full changelog: https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
v2.9.1 — Hardening and provenance
2.9.1 — Hardening release and provenance proof
This release publishes the hardening already merged to main and is the first
release built with the PEP 740 and GitHub build-provenance workflow.
Added
- CI tests the minimum supported dependency versions on Python 3.10, the latest
stable dependency set, and pandas 3.x. - CI installs the built wheel in a clean environment and checks imports, public
exports, the CLI, and a small end-to-end cleaning workflow. - Release builds generate PEP 740 attestations for PyPI and GitHub
build-provenance attestations, so published artifacts can be verified against
the workflow that built them.
Changed
iter_csv_safe()infers the schema from the first chunk and reuses it for every
later chunk. A later value that does not fit the inferred type is reported as
unparseable_valuesinstead of silently changing the column dtype. Pass an
explicit contract when the first chunk may not be representative.- Safe ingestion enforces
ColumnSpec(unique=True)and reports
duplicate_values. Duplicates are detected within a frame and, for
iter_csv_safe(), across chunks. Missing values are ignored. DataContract.check()ignores missing values forunique=True, matching the
documented "non-null values must be unique" behavior and the validation helper.DataCleaner.transform()documents that a missing fitted input column is always
fatal, regardless ofon_drift, because the cleaner cannot safely reconstruct
it.
Provenance
2.9.0 predates the attestation workflow and correctly shows no PyPI provenance.
2.9.1 is the first attested release. Verify a downloaded artifact with:
uvx "pypi-attestations==0.0.31" verify pypi \
--repository https://github.com/devlprkhan/universal-data-cleaner \
pypi:universal_data_cleaner-2.9.1-py3-none-any.whl
gh attestation verify universal_data_cleaner-2.9.1-py3-none-any.whl \
--repo devlprkhan/universal-data-cleanerFull changelog: https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
v2.9.0 — Reliability hardening
2.9.0 — Reliability hardening
This release hardens the paths that already exist rather than adding another data primitive.
Added
ColumnSpec(required=...)marks a contract column as required or optional.ArtifactCompatibilityErroris raised byDataCleaner.load()when a saved artifact has an incompatible artifact format or library major version. Useallow_incompatible=Trueto load it with a warning, orverify_version=Falseto skip the check.iter_csv_safe()streams a large CSV in typed chunks and yields one(frame, IngestionReport)pair per chunk, using bounded memory.CleanerConfig.outlier_columnsnames the numeric columns that may be capped. When set it acts as an allowlist and overridescap_outliers.read_csv_safe()emits aninteger_precisionwarning for integer values beyond2^53that are coerced tofloat64.
Changed
DataCleaner.fit()now validates an explicit contract before learning and raisesValueErrorwhen a required training column is missing. Columns withrequired=Falseorrole="ignore"may be absent.diagnose_join()computes matched and unmatched rows from grouped key frequencies, so duplicated keys no longer expand into a many-to-many join.- Outlier clipping is now opt-in:
CleanerConfig.cap_outliersdefaults toFalse. Set it toTrue, or listoutlier_columns, to keep the previous clipping behavior. - CSV ingestion normalizes blank cells in place instead of copying the whole frame.
- The public API is documented in stable, experimental, and internal tiers with a deprecation policy.
data_cleaner.__all__is the canonical surface. - Refined the documentation site chrome and navigation.
Migration notes
- If you relied on outlier clipping, set
cap_outliers=Trueor list the columns inoutlier_columns. - Incompatible artifacts now raise by default. Retrain and resave, or pass
allow_incompatible=Trueonly if you accept the risk.
Full changelog: https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
v2.8.0 — Excel ingestion
Added
read_excel_safe(): read one Excel worksheet, normalize every cell to text, apply the same contract-driven guards asread_csv_safe(), and return the typed frame with anIngestionReport.- Worksheet selection with
sheet_name, accepting a name or a non-negative zero-based index. The resolved sheet is recorded onIngestionReport.sheet. CleanerReport.from_excel(): attach Excel ingestion findings to the same profile, contract, validation, and decision report as CSV input.data-cleaner auditnow detects.xlsx,.xlsm,.xls,.xlsb, and.odsinput and accepts--sheet NAMEor--sheet-index N.numeric_identifierwarning when a contract ID column is stored as numbers in the spreadsheet and has already lost its leading zeros.- Optional
excelextra (openpyxl>=3.1) for.xlsxand.xlsmworkbooks.read_csv_safe()remains dependency-free. - Per-cell date guards so one datetime column can mix real dates, compact
YYYYMMDDvalues, and Excel serials. - Duplicate column headers after string conversion are rejected with a clear error.
- URL source labels are stored without credentials or query strings.
Documentation
- Excel sections across the ingestion, reporting, quickstart, production, and API guides.
- README install extra and feature list, CHANGELOG, ROADMAP Tier 7, and Upcoming.
Notes
IngestionReportgainssheet(defaultNone) andlocation; bothto_markdown()and warning/error messages name the resolved sheet.IngestionReport.raise_if_failed()defaults to the format-neutral message"Ingestion failed";read_csv_safe()andread_excel_safe()still name their format.- Real Excel date cells are parsed directly. Numbers in a datetime column are treated as Excel serial dates and flagged with
excel_serial_date. - Excel cannot preserve leading zeros in a cell stored as a number. The reader warns with
numeric_identifier, but store identifiers as text to avoid the loss. .xls,.xlsb, and.odsfiles need the matching pandas engine (xlrd,pyxlsb, orodfpy); theexcelextra covers.xlsxand.xlsm.- Artifact format remains
2; this release is additive.
v2.7.0 — Batch reporting
Added
CleanerReport: one review object per batch combining the dataset profile, contract drift, validation results, ingestion findings, and the fitted cleaner's decision log.from_frame(),from_csv(), andfrom_cleaner()entry points that never transform the input or re-fit the cleaner.- A tidy
findingstable pluserrors,warnings,success,summary(),to_markdown(),to_dict(),to_json(), andraise_if_failed(). - Profile warnings for empty datasets, empty columns, constant columns, high missingness, and duplicate rows.
python -m data_cleaner audit data.csvand thedata-cleanerconsole script with--contract,--cleaner,--name,--format markdown|json,--output,--no-profile, and--fail-on-warning.- Stable CLI exit codes:
0success,1error findings (or warnings with--fail-on-warning),2input or configuration errors.
Documentation
- New Batch reporting guide with API and CLI examples.
- Updated API reference, nav, homepage, quickstart, production guide, ingestion cross-links, artifacts, README, CHANGELOG, ROADMAP, and Upcoming.
Notes
CleanerReport.from_csv()defaults toon_error="ignore"so a report is always returned; error findings still makesuccessfalse.- Reports contain column names, counts, and messages only; they never include raw cell values.
- The CLI reads with
on_error="ignore"and derives failure from the report. - Artifact format remains
2.
v2.6.0 — Safe CSV ingestion
Added
read_csv_safe(): string-first CSV ingestion with contract-driven coercion and anIngestionReportcovering per-column detection, output dtypes, missing counts, and every normalization performed.- Identifier protection: ID columns and values with leading zeros stay text, with
leading_zeros_preservedfindings. - Spreadsheet artifact handling for numeric fields: thousands separators, currency symbols, percent signs, accounting parentheses, and decimal commas.
- Date guards for compact
YYYYMMDDvalues and Excel serial dates when the contract declaresrole="datetime", plus explicitdate_formatsupport and anambiguous_date_formatwarning. - Boolean normalization for Y/N-style tokens with
boolean_tokensfindings. IngestionErrorand theon_error="warn" | "raise" | "ignore"policy.mixed_typesandempty_columnfindings.
Documentation
- New Safe ingestion guide and Upcoming page.
- Updated API reference, nav, homepage, quickstart, production guide, leak-safe workflow, README, CHANGELOG, and ROADMAP.
Notes
- The ingestion report contains column names, counts, and messages only; it never includes raw cell values.
- Without a contract,
YYYYMMDDand Excel serial values remain numeric. Declare a datetime role when they are dates. - CSV is the supported input for this release; Excel ingestion is planned.
- Artifact format remains
2.
v2.5.2
Documentation-only release
2.5.2 makes the documentation site the single source of truth and publishes the streamlined README to PyPI.
Documentation
- README is now a concise front door: install, quick start, leak-safe example, feature summary, docs index, development workflow, and project layout.
- Duplicated contract, validation/join, ML audit, manifest, pipeline, public API, and production guides were removed from the README.
- Added Artifacts & reproducibility and a Production guide to the docs site.
- Every guide is linked from the README and the docs navigation.
Notes
- No runtime behavior changes; artifact format remains
2. - Full documentation: https://devlprkhan.github.io/universal-data-cleaner/
- PyPI: https://pypi.org/project/universal-data-cleaner/2.5.2/
v2.5.1
Documentation-only release
2.5.1 publishes the documentation site as the central reference from both GitHub and PyPI.
Documentation
- Add a MkDocs Material documentation site with task guides, an API reference, generated changelog, search, and dark mode.
- Expose the documentation site in the package project URLs and README.
Notes
- No runtime behavior changes; the artifact format remains
2. - Full documentation: https://devlprkhan.github.io/universal-data-cleaner/
- PyPI: https://pypi.org/project/universal-data-cleaner/2.5.1/