universal-data-cleaner 2.4.0__tar.gz → 2.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {universal_data_cleaner-2.4.0/src/universal_data_cleaner.egg-info → universal_data_cleaner-2.5.1}/PKG-INFO +67 -1
  2. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/README.md +65 -0
  3. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/pyproject.toml +6 -1
  4. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/__init__.py +3 -0
  5. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/_version.py +1 -1
  6. universal_data_cleaner-2.5.1/src/data_cleaner/ml_audit.py +1212 -0
  7. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1/src/universal_data_cleaner.egg-info}/PKG-INFO +67 -1
  8. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/universal_data_cleaner.egg-info/SOURCES.txt +2 -0
  9. universal_data_cleaner-2.5.1/tests/test_ml_audit.py +765 -0
  10. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/LICENSE +0 -0
  11. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/setup.cfg +0 -0
  12. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/_roles.py +0 -0
  13. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/artifacts.py +0 -0
  14. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/cleaner.py +0 -0
  15. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/config.py +0 -0
  16. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/contract.py +0 -0
  17. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/decisions.py +0 -0
  18. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/integration.py +0 -0
  19. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/profiling.py +0 -0
  20. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/py.typed +0 -0
  21. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/data_cleaner/validation.py +0 -0
  22. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/universal_data_cleaner.egg-info/dependency_links.txt +0 -0
  23. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/universal_data_cleaner.egg-info/requires.txt +0 -0
  24. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/src/universal_data_cleaner.egg-info/top_level.txt +0 -0
  25. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/tests/test_data_cleaner.py +0 -0
  26. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.1}/tests/test_validation.py +0 -0
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: universal-data-cleaner
3
- Version: 2.4.0
3
+ Version: 2.5.1
4
4
  Summary: Production-ready, scikit-learn-compatible data cleaning transformer for pandas.
5
5
  Author: Haseeb Khan
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/devlprkhan/universal-data-cleaner
8
+ Project-URL: Documentation, https://devlprkhan.github.io/universal-data-cleaner/
8
9
  Project-URL: Repository, https://github.com/devlprkhan/universal-data-cleaner
9
10
  Project-URL: Issues, https://github.com/devlprkhan/universal-data-cleaner/issues
10
11
  Project-URL: Changelog, https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
@@ -34,6 +35,7 @@ Dynamic: license-file
34
35
  # Universal Data Cleaner
35
36
 
36
37
  [![CI](https://github.com/devlprkhan/universal-data-cleaner/actions/workflows/ci.yml/badge.svg)](https://github.com/devlprkhan/universal-data-cleaner/actions/workflows/ci.yml)
38
+ [![Docs](https://img.shields.io/badge/docs-online-4f46e5.svg)](https://devlprkhan.github.io/universal-data-cleaner/)
37
39
  [![PyPI](https://img.shields.io/pypi/v/universal-data-cleaner.svg)](https://pypi.org/project/universal-data-cleaner/)
38
40
  [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
39
41
  [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
@@ -44,6 +46,21 @@ A small, production-oriented tabular cleaning transformer for pandas + scikit-le
44
46
  It is designed for the part of an ML pipeline that is easy to get wrong: cleaning
45
47
  training data and inference data with **exactly the same learned rules**.
46
48
 
49
+ ## Documentation
50
+
51
+ The full documentation is the central reference:
52
+
53
+ **[devlprkhan.github.io/universal-data-cleaner](https://devlprkhan.github.io/universal-data-cleaner/)**
54
+
55
+ - [Quickstart](https://devlprkhan.github.io/universal-data-cleaner/quickstart/)
56
+ - [Leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/)
57
+ - [Cleaning guide](https://devlprkhan.github.io/universal-data-cleaner/cleaning/)
58
+ - [Contracts & drift](https://devlprkhan.github.io/universal-data-cleaner/contracts/)
59
+ - [Validation, joins & dedup](https://devlprkhan.github.io/universal-data-cleaner/validation-joins/)
60
+ - [ML split audit](https://devlprkhan.github.io/universal-data-cleaner/ml-split-audit/)
61
+ - [API reference](https://devlprkhan.github.io/universal-data-cleaner/api/)
62
+ - [Changelog](https://devlprkhan.github.io/universal-data-cleaner/changelog/)
63
+
47
64
  ## Why this exists
48
65
 
49
66
  A common notebook pattern is:
@@ -73,6 +90,7 @@ breaks at inference time because the median is recomputed on the new batch.
73
90
  - automatic train-schema contract inference and transform-time drift reports
74
91
  - `on_drift` policy: `raise`, `warn`, or `ignore`
75
92
  - identifier columns that are never numeric-coerced, median-imputed, or capped
93
+ - train/test split audits for duplicate, group, temporal, and target leakage
76
94
  - joblib save / load with artifact versioning
77
95
  - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
78
96
 
@@ -345,6 +363,48 @@ The returned frame preserves the input row order and index. `tie_breaker`
345
363
  prefers non-null values, and null business keys are reported explicitly.
346
364
  The input frame is never mutated.
347
365
 
366
+ ## ML split audits
367
+
368
+ Audit a train/test split for contamination and distribution surprises before
369
+ training:
370
+
371
+ ```python
372
+ from data_cleaner import audit_split
373
+
374
+ audit = audit_split(
375
+ X_train,
376
+ X_test,
377
+ y_train,
378
+ y_test,
379
+ groups=groups, # combined train+test labels, or pass groups_test=
380
+ time_col="event_time",
381
+ id_cols=["customer_id"],
382
+ )
383
+
384
+ audit.valid # False when an error-severity finding exists
385
+ audit.findings # check, column, severity, message, train, test
386
+ audit.summary()
387
+ audit.to_markdown()
388
+ audit.raise_if_invalid()
389
+ ```
390
+
391
+ Schema problems such as missing columns, empty splits, exact duplicate overlap,
392
+ group leakage, temporal leakage, and unparseable or numeric timestamps are
393
+ errors. Near-duplicates, constant / near-constant columns, high-cardinality
394
+ identifiers, missingness and distribution shift, target-leakage heuristics, and
395
+ target shift are warnings because they can be legitimate properties of a
396
+ dataset. The audit only reports; it never repairs or reorders a split.
397
+
398
+ `groups` may hold labels for both splits (`len(X_train) + len(X_test)`); pass
399
+ `groups_test` when it only covers the training rows. Duplicate checks exclude
400
+ `id_cols` and `time_col`; declared identifiers are still reported under
401
+ `high_cardinality_identifier` when their cardinality is high. Near-duplicates
402
+ are approximated deterministically by hashing rows with numeric features
403
+ rounded to `near_duplicate_decimals` (default `3`).
404
+
405
+ Findings never include raw cell values. Messages carry column names, counts,
406
+ rates, and statistics only, so reports can be logged safely.
407
+
348
408
  ## Audit trail, manifests, and fingerprints
349
409
 
350
410
  Every learned or configured decision is recorded during `fit()` and exposed as
@@ -456,6 +516,8 @@ predictions = pipeline.predict(X_test)
456
516
  | `ReferentialIntegrityReport` | Orphan counts/keys, null keys, and validity |
457
517
  | `deduplicate_by_business_key` | Deduplicate by key and report removed rows |
458
518
  | `DeduplicationReport` | Removed rows, duplicate-key counts, and tie-breaker details |
519
+ | `audit_split` | Audit a train/test split for leakage and distribution shift |
520
+ | `SplitAudit` | Findings table with validity, Markdown, and raise helper |
459
521
  | `DataCleaner.drift_report()` | Drift findings from the last `transform` |
460
522
  | `DataCleaner.fitted_contract()` | The contract used by the fitted cleaner |
461
523
  | `DataCleaner.decision_log()` | Tidy DataFrame of cleaning decisions |
@@ -505,12 +567,16 @@ predictions = pipeline.predict(X_test)
505
567
  │ ├── cleaner.py # DataCleaner
506
568
  │ ├── decisions.py # CleaningDecision and decision log
507
569
  │ ├── integration.py # joins, referential integrity, dedup
570
+ │ ├── ml_audit.py # train/test leakage and shift audit
508
571
  │ ├── profiling.py # profiling and validation helpers
509
572
  │ ├── validation.py # expectations and ValidationReport
510
573
  │ └── py.typed # PEP 561 marker
511
574
  ├── Universal_Data_Cleaner.ipynb # end-to-end reference workflow
512
575
  ├── tests/test_data_cleaner.py # core unit and integration tests
513
576
  ├── tests/test_validation.py # expectations and integration tests
577
+ ├── tests/test_ml_audit.py # split/leakage audit tests
578
+ ├── docs/ # MkDocs guides, API page, and assets
579
+ ├── mkdocs.yml # documentation site configuration
514
580
  ├── pyproject.toml # package metadata and dev tooling
515
581
  ├── uv.lock # reproducible dependency lock
516
582
  ├── .pre-commit-config.yaml # local lint/format/type hooks
@@ -1,6 +1,7 @@
1
1
  # Universal Data Cleaner
2
2
 
3
3
  [![CI](https://github.com/devlprkhan/universal-data-cleaner/actions/workflows/ci.yml/badge.svg)](https://github.com/devlprkhan/universal-data-cleaner/actions/workflows/ci.yml)
4
+ [![Docs](https://img.shields.io/badge/docs-online-4f46e5.svg)](https://devlprkhan.github.io/universal-data-cleaner/)
4
5
  [![PyPI](https://img.shields.io/pypi/v/universal-data-cleaner.svg)](https://pypi.org/project/universal-data-cleaner/)
5
6
  [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
6
7
  [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](LICENSE)
@@ -11,6 +12,21 @@ A small, production-oriented tabular cleaning transformer for pandas + scikit-le
11
12
  It is designed for the part of an ML pipeline that is easy to get wrong: cleaning
12
13
  training data and inference data with **exactly the same learned rules**.
13
14
 
15
+ ## Documentation
16
+
17
+ The full documentation is the central reference:
18
+
19
+ **[devlprkhan.github.io/universal-data-cleaner](https://devlprkhan.github.io/universal-data-cleaner/)**
20
+
21
+ - [Quickstart](https://devlprkhan.github.io/universal-data-cleaner/quickstart/)
22
+ - [Leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/)
23
+ - [Cleaning guide](https://devlprkhan.github.io/universal-data-cleaner/cleaning/)
24
+ - [Contracts & drift](https://devlprkhan.github.io/universal-data-cleaner/contracts/)
25
+ - [Validation, joins & dedup](https://devlprkhan.github.io/universal-data-cleaner/validation-joins/)
26
+ - [ML split audit](https://devlprkhan.github.io/universal-data-cleaner/ml-split-audit/)
27
+ - [API reference](https://devlprkhan.github.io/universal-data-cleaner/api/)
28
+ - [Changelog](https://devlprkhan.github.io/universal-data-cleaner/changelog/)
29
+
14
30
  ## Why this exists
15
31
 
16
32
  A common notebook pattern is:
@@ -40,6 +56,7 @@ breaks at inference time because the median is recomputed on the new batch.
40
56
  - automatic train-schema contract inference and transform-time drift reports
41
57
  - `on_drift` policy: `raise`, `warn`, or `ignore`
42
58
  - identifier columns that are never numeric-coerced, median-imputed, or capped
59
+ - train/test split audits for duplicate, group, temporal, and target leakage
43
60
  - joblib save / load with artifact versioning
44
61
  - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
45
62
 
@@ -312,6 +329,48 @@ The returned frame preserves the input row order and index. `tie_breaker`
312
329
  prefers non-null values, and null business keys are reported explicitly.
313
330
  The input frame is never mutated.
314
331
 
332
+ ## ML split audits
333
+
334
+ Audit a train/test split for contamination and distribution surprises before
335
+ training:
336
+
337
+ ```python
338
+ from data_cleaner import audit_split
339
+
340
+ audit = audit_split(
341
+ X_train,
342
+ X_test,
343
+ y_train,
344
+ y_test,
345
+ groups=groups, # combined train+test labels, or pass groups_test=
346
+ time_col="event_time",
347
+ id_cols=["customer_id"],
348
+ )
349
+
350
+ audit.valid # False when an error-severity finding exists
351
+ audit.findings # check, column, severity, message, train, test
352
+ audit.summary()
353
+ audit.to_markdown()
354
+ audit.raise_if_invalid()
355
+ ```
356
+
357
+ Schema problems such as missing columns, empty splits, exact duplicate overlap,
358
+ group leakage, temporal leakage, and unparseable or numeric timestamps are
359
+ errors. Near-duplicates, constant / near-constant columns, high-cardinality
360
+ identifiers, missingness and distribution shift, target-leakage heuristics, and
361
+ target shift are warnings because they can be legitimate properties of a
362
+ dataset. The audit only reports; it never repairs or reorders a split.
363
+
364
+ `groups` may hold labels for both splits (`len(X_train) + len(X_test)`); pass
365
+ `groups_test` when it only covers the training rows. Duplicate checks exclude
366
+ `id_cols` and `time_col`; declared identifiers are still reported under
367
+ `high_cardinality_identifier` when their cardinality is high. Near-duplicates
368
+ are approximated deterministically by hashing rows with numeric features
369
+ rounded to `near_duplicate_decimals` (default `3`).
370
+
371
+ Findings never include raw cell values. Messages carry column names, counts,
372
+ rates, and statistics only, so reports can be logged safely.
373
+
315
374
  ## Audit trail, manifests, and fingerprints
316
375
 
317
376
  Every learned or configured decision is recorded during `fit()` and exposed as
@@ -423,6 +482,8 @@ predictions = pipeline.predict(X_test)
423
482
  | `ReferentialIntegrityReport` | Orphan counts/keys, null keys, and validity |
424
483
  | `deduplicate_by_business_key` | Deduplicate by key and report removed rows |
425
484
  | `DeduplicationReport` | Removed rows, duplicate-key counts, and tie-breaker details |
485
+ | `audit_split` | Audit a train/test split for leakage and distribution shift |
486
+ | `SplitAudit` | Findings table with validity, Markdown, and raise helper |
426
487
  | `DataCleaner.drift_report()` | Drift findings from the last `transform` |
427
488
  | `DataCleaner.fitted_contract()` | The contract used by the fitted cleaner |
428
489
  | `DataCleaner.decision_log()` | Tidy DataFrame of cleaning decisions |
@@ -472,12 +533,16 @@ predictions = pipeline.predict(X_test)
472
533
  │ ├── cleaner.py # DataCleaner
473
534
  │ ├── decisions.py # CleaningDecision and decision log
474
535
  │ ├── integration.py # joins, referential integrity, dedup
536
+ │ ├── ml_audit.py # train/test leakage and shift audit
475
537
  │ ├── profiling.py # profiling and validation helpers
476
538
  │ ├── validation.py # expectations and ValidationReport
477
539
  │ └── py.typed # PEP 561 marker
478
540
  ├── Universal_Data_Cleaner.ipynb # end-to-end reference workflow
479
541
  ├── tests/test_data_cleaner.py # core unit and integration tests
480
542
  ├── tests/test_validation.py # expectations and integration tests
543
+ ├── tests/test_ml_audit.py # split/leakage audit tests
544
+ ├── docs/ # MkDocs guides, API page, and assets
545
+ ├── mkdocs.yml # documentation site configuration
481
546
  ├── pyproject.toml # package metadata and dev tooling
482
547
  ├── uv.lock # reproducible dependency lock
483
548
  ├── .pre-commit-config.yaml # local lint/format/type hooks
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "universal-data-cleaner"
7
- version = "2.4.0"
7
+ version = "2.5.1"
8
8
  description = "Production-ready, scikit-learn-compatible data cleaning transformer for pandas."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -45,11 +45,16 @@ dependencies = [
45
45
 
46
46
  [project.urls]
47
47
  Homepage = "https://github.com/devlprkhan/universal-data-cleaner"
48
+ Documentation = "https://devlprkhan.github.io/universal-data-cleaner/"
48
49
  Repository = "https://github.com/devlprkhan/universal-data-cleaner"
49
50
  Issues = "https://github.com/devlprkhan/universal-data-cleaner/issues"
50
51
  Changelog = "https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md"
51
52
 
52
53
  [dependency-groups]
54
+ docs = [
55
+ "mkdocs-material>=9.5",
56
+ "mkdocstrings[python]>=0.26",
57
+ ]
53
58
  dev = [
54
59
  "ipykernel>=7.3.0",
55
60
  "jupyterlab>=4.6.4",
@@ -30,6 +30,7 @@ from .integration import (
30
30
  deduplicate_by_business_key,
31
31
  diagnose_join,
32
32
  )
33
+ from .ml_audit import SplitAudit, audit_split
33
34
  from .profiling import (
34
35
  assert_frame_clean,
35
36
  dataset_summary,
@@ -62,11 +63,13 @@ __all__ = [
62
63
  "Expectation",
63
64
  "JoinDiagnosis",
64
65
  "ReferentialIntegrityReport",
66
+ "SplitAudit",
65
67
  "ValidationReport",
66
68
  "ValidationResult",
67
69
  "__version__",
68
70
  "assert_frame_clean",
69
71
  "assert_schema_stable",
72
+ "audit_split",
70
73
  "between",
71
74
  "check_referential_integrity",
72
75
  "compare_fingerprints",
@@ -1,4 +1,4 @@
1
1
  """Single source of truth for the package version."""
2
2
 
3
- __version__ = "2.4.0"
3
+ __version__ = "2.5.1"
4
4
  _ARTIFACT_VERSION = 2