universal-data-cleaner 2.5.0__tar.gz → 2.5.2__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 (29) hide show
  1. universal_data_cleaner-2.5.2/PKG-INFO +205 -0
  2. universal_data_cleaner-2.5.2/README.md +171 -0
  3. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/pyproject.toml +6 -1
  4. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/_version.py +1 -1
  5. universal_data_cleaner-2.5.2/src/universal_data_cleaner.egg-info/PKG-INFO +205 -0
  6. universal_data_cleaner-2.5.0/PKG-INFO +0 -583
  7. universal_data_cleaner-2.5.0/README.md +0 -550
  8. universal_data_cleaner-2.5.0/src/universal_data_cleaner.egg-info/PKG-INFO +0 -583
  9. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/LICENSE +0 -0
  10. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/setup.cfg +0 -0
  11. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/__init__.py +0 -0
  12. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/_roles.py +0 -0
  13. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/artifacts.py +0 -0
  14. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/cleaner.py +0 -0
  15. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/config.py +0 -0
  16. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/contract.py +0 -0
  17. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/decisions.py +0 -0
  18. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/integration.py +0 -0
  19. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/ml_audit.py +0 -0
  20. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/profiling.py +0 -0
  21. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/py.typed +0 -0
  22. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/data_cleaner/validation.py +0 -0
  23. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/universal_data_cleaner.egg-info/SOURCES.txt +0 -0
  24. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/universal_data_cleaner.egg-info/dependency_links.txt +0 -0
  25. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/universal_data_cleaner.egg-info/requires.txt +0 -0
  26. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/src/universal_data_cleaner.egg-info/top_level.txt +0 -0
  27. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/tests/test_data_cleaner.py +0 -0
  28. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/tests/test_ml_audit.py +0 -0
  29. {universal_data_cleaner-2.5.0 → universal_data_cleaner-2.5.2}/tests/test_validation.py +0 -0
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: universal-data-cleaner
3
+ Version: 2.5.2
4
+ Summary: Production-ready, scikit-learn-compatible data cleaning transformer for pandas.
5
+ Author: Haseeb Khan
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/devlprkhan/universal-data-cleaner
8
+ Project-URL: Documentation, https://devlprkhan.github.io/universal-data-cleaner/
9
+ Project-URL: Repository, https://github.com/devlprkhan/universal-data-cleaner
10
+ Project-URL: Issues, https://github.com/devlprkhan/universal-data-cleaner/issues
11
+ Project-URL: Changelog, https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
12
+ Keywords: data-cleaning,data-quality,data-preprocessing,feature-engineering,machine-learning,pandas,scikit-learn,tabular-data
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Natural Language :: English
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: pandas>=2.2
30
+ Requires-Dist: numpy>=1.26
31
+ Requires-Dist: scikit-learn>=1.4
32
+ Requires-Dist: joblib>=1.3
33
+ Dynamic: license-file
34
+
35
+ # Universal Data Cleaner
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/)
39
+ [![PyPI](https://img.shields.io/pypi/v/universal-data-cleaner.svg)](https://pypi.org/project/universal-data-cleaner/)
40
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
41
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/devlprkhan/universal-data-cleaner/blob/main/LICENSE)
42
+ [![Managed with uv](https://img.shields.io/badge/managed%20with-uv-6f42c1.svg)](https://docs.astral.sh/uv/)
43
+
44
+ A small, production-oriented tabular cleaning transformer for pandas + scikit-learn.
45
+
46
+ It is designed for the part of an ML pipeline that is easy to get wrong: cleaning
47
+ training data and inference data with **exactly the same learned rules**.
48
+
49
+ ## Documentation
50
+
51
+ **[Full documentation →](https://devlprkhan.github.io/universal-data-cleaner/)**
52
+
53
+ The docs site is the central reference. This README is the short entry point.
54
+
55
+ | Guide | What it covers |
56
+ | --- | --- |
57
+ | [Quickstart](https://devlprkhan.github.io/universal-data-cleaner/quickstart/) | Install, first cleaner, scikit-learn pipeline |
58
+ | [Leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/) | The fit/transform contract and common mistakes |
59
+ | [Cleaning data](https://devlprkhan.github.io/universal-data-cleaner/cleaning/) | Config, roles, imputation, outliers, datetimes |
60
+ | [Contracts & drift](https://devlprkhan.github.io/universal-data-cleaner/contracts/) | `ColumnSpec`, `DataContract`, drift checks |
61
+ | [Validation, joins & dedup](https://devlprkhan.github.io/universal-data-cleaner/validation-joins/) | Expectations, join diagnostics, integrity, dedup |
62
+ | [ML split audit](https://devlprkhan.github.io/universal-data-cleaner/ml-split-audit/) | Duplicate, group, temporal, and target leakage |
63
+ | [Artifacts & reproducibility](https://devlprkhan.github.io/universal-data-cleaner/artifacts/) | Decision log, manifests, fingerprints, save/load |
64
+ | [Production guide](https://devlprkhan.github.io/universal-data-cleaner/production/) | Deployment checklist and failure modes |
65
+ | [API reference](https://devlprkhan.github.io/universal-data-cleaner/api/) | Generated from the package docstrings |
66
+ | [Changelog](https://devlprkhan.github.io/universal-data-cleaner/changelog/) | Release notes |
67
+
68
+ ## Install
69
+
70
+ ```bash
71
+ pip install universal-data-cleaner
72
+ ```
73
+
74
+ ```bash
75
+ uv add universal-data-cleaner
76
+ ```
77
+
78
+ The distribution name is `universal-data-cleaner`; the import name is
79
+ `data_cleaner`.
80
+
81
+ ```python
82
+ from data_cleaner import CleanerConfig, DataCleaner
83
+ ```
84
+
85
+ ## Quick start
86
+
87
+ ```python
88
+ import pandas as pd
89
+ from data_cleaner import CleanerConfig, DataCleaner
90
+
91
+ train = pd.DataFrame(
92
+ {
93
+ "age": [34, 41, None, 29],
94
+ "salary": [70_000, 82_000, 91_000, 55_000],
95
+ "dept": ["IT", "HR", "IT", None],
96
+ "joined": ["2022-01-03", "2021-11-20", "2023-04-01", "bad-date"],
97
+ }
98
+ )
99
+
100
+ config = CleanerConfig(
101
+ datetime_columns=("joined",),
102
+ add_missing_indicators=True,
103
+ drop_constant_columns=True,
104
+ )
105
+
106
+ cleaner = DataCleaner(config).fit(train)
107
+ train_clean = cleaner.transform(train)
108
+ ```
109
+
110
+ `fit()` learns medians, modes, outlier bounds, category values, and datetime
111
+ rules from `train`. `transform()` applies those stored rules without learning
112
+ from the frame you pass in.
113
+
114
+ ## Leak-safe by construction
115
+
116
+ ```python
117
+ cleaner = DataCleaner(config).fit(X_train)
118
+
119
+ X_train_clean = cleaner.transform(X_train)
120
+ X_test_clean = cleaner.transform(X_test) # training rules only
121
+ ```
122
+
123
+ Never fit before splitting, and never create a new cleaner for test or
124
+ production data. See the [leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/)
125
+ for the full explanation.
126
+
127
+ ## What it handles
128
+
129
+ - numeric coercion, median / mean / constant imputation, and IQR capping
130
+ - categorical mode / constant imputation and a keep-or-fill unseen policy
131
+ - boolean coercion and imputation
132
+ - datetime parsing plus calendar feature extraction
133
+ - optional missing-value indicators and constant-column dropping
134
+ - declarative contracts with roles, allowed values, ranges, patterns, and uniqueness
135
+ - automatic train-schema contract inference and transform-time drift reports
136
+ - expectation checks and validation reports
137
+ - join diagnostics, referential integrity, and audited business-key dedup
138
+ - train/test split audits for duplicate, group, temporal, and target leakage
139
+ - joblib save / load, manifests, and stable data fingerprints
140
+ - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
141
+ - stable output schema and column order; inputs are never mutated and inference
142
+ rows are never dropped
143
+
144
+ ## Development
145
+
146
+ ```bash
147
+ git clone https://github.com/devlprkhan/universal-data-cleaner.git
148
+ cd universal-data-cleaner
149
+ uv sync --dev
150
+ uv run pytest -q
151
+ ```
152
+
153
+ Run the full quality gate:
154
+
155
+ ```bash
156
+ uv run ruff check .
157
+ uv run ruff format --check .
158
+ uv run mypy
159
+ uv run pytest
160
+ uv build
161
+ ```
162
+
163
+ Build or preview the docs:
164
+
165
+ ```bash
166
+ uv sync --group docs
167
+ uv run --group docs mkdocs serve
168
+ uv run --group docs mkdocs build --strict
169
+ ```
170
+
171
+ The reference notebook is `Universal_Data_Cleaner.ipynb`. Open it with:
172
+
173
+ ```bash
174
+ uv run jupyter lab Universal_Data_Cleaner.ipynb
175
+ ```
176
+
177
+ ## Project layout
178
+
179
+ ```text
180
+ src/data_cleaner/ # typed, pip-installable package
181
+ tests/ # unit and integration tests
182
+ docs/ # MkDocs guides, API page, and assets
183
+ mkdocs.yml # documentation site configuration
184
+ Universal_Data_Cleaner.ipynb # end-to-end reference workflow
185
+ pyproject.toml # package metadata and tooling
186
+ uv.lock # reproducible dependency lock
187
+ CHANGELOG.md # release notes
188
+ CONTRIBUTING.md # development workflow
189
+ SECURITY.md # vulnerability reporting
190
+ LICENSE # MIT license
191
+ ```
192
+
193
+ The package ships a `py.typed` marker, so `mypy`, `pyright`, and IDE tooling pick
194
+ up the type annotations automatically. Linting, formatting, type checking, tests,
195
+ the docs build, and package build run in CI.
196
+
197
+ ## Contributing
198
+
199
+ Contributions are welcome. See
200
+ [CONTRIBUTING.md](https://github.com/devlprkhan/universal-data-cleaner/blob/main/CONTRIBUTING.md)
201
+ for the local setup, quality gate, and pull-request expectations.
202
+
203
+ ## License
204
+
205
+ Released under the [MIT License](https://github.com/devlprkhan/universal-data-cleaner/blob/main/LICENSE).
@@ -0,0 +1,171 @@
1
+ # Universal Data Cleaner
2
+
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/)
5
+ [![PyPI](https://img.shields.io/pypi/v/universal-data-cleaner.svg)](https://pypi.org/project/universal-data-cleaner/)
6
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/devlprkhan/universal-data-cleaner/blob/main/LICENSE)
8
+ [![Managed with uv](https://img.shields.io/badge/managed%20with-uv-6f42c1.svg)](https://docs.astral.sh/uv/)
9
+
10
+ A small, production-oriented tabular cleaning transformer for pandas + scikit-learn.
11
+
12
+ It is designed for the part of an ML pipeline that is easy to get wrong: cleaning
13
+ training data and inference data with **exactly the same learned rules**.
14
+
15
+ ## Documentation
16
+
17
+ **[Full documentation →](https://devlprkhan.github.io/universal-data-cleaner/)**
18
+
19
+ The docs site is the central reference. This README is the short entry point.
20
+
21
+ | Guide | What it covers |
22
+ | --- | --- |
23
+ | [Quickstart](https://devlprkhan.github.io/universal-data-cleaner/quickstart/) | Install, first cleaner, scikit-learn pipeline |
24
+ | [Leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/) | The fit/transform contract and common mistakes |
25
+ | [Cleaning data](https://devlprkhan.github.io/universal-data-cleaner/cleaning/) | Config, roles, imputation, outliers, datetimes |
26
+ | [Contracts & drift](https://devlprkhan.github.io/universal-data-cleaner/contracts/) | `ColumnSpec`, `DataContract`, drift checks |
27
+ | [Validation, joins & dedup](https://devlprkhan.github.io/universal-data-cleaner/validation-joins/) | Expectations, join diagnostics, integrity, dedup |
28
+ | [ML split audit](https://devlprkhan.github.io/universal-data-cleaner/ml-split-audit/) | Duplicate, group, temporal, and target leakage |
29
+ | [Artifacts & reproducibility](https://devlprkhan.github.io/universal-data-cleaner/artifacts/) | Decision log, manifests, fingerprints, save/load |
30
+ | [Production guide](https://devlprkhan.github.io/universal-data-cleaner/production/) | Deployment checklist and failure modes |
31
+ | [API reference](https://devlprkhan.github.io/universal-data-cleaner/api/) | Generated from the package docstrings |
32
+ | [Changelog](https://devlprkhan.github.io/universal-data-cleaner/changelog/) | Release notes |
33
+
34
+ ## Install
35
+
36
+ ```bash
37
+ pip install universal-data-cleaner
38
+ ```
39
+
40
+ ```bash
41
+ uv add universal-data-cleaner
42
+ ```
43
+
44
+ The distribution name is `universal-data-cleaner`; the import name is
45
+ `data_cleaner`.
46
+
47
+ ```python
48
+ from data_cleaner import CleanerConfig, DataCleaner
49
+ ```
50
+
51
+ ## Quick start
52
+
53
+ ```python
54
+ import pandas as pd
55
+ from data_cleaner import CleanerConfig, DataCleaner
56
+
57
+ train = pd.DataFrame(
58
+ {
59
+ "age": [34, 41, None, 29],
60
+ "salary": [70_000, 82_000, 91_000, 55_000],
61
+ "dept": ["IT", "HR", "IT", None],
62
+ "joined": ["2022-01-03", "2021-11-20", "2023-04-01", "bad-date"],
63
+ }
64
+ )
65
+
66
+ config = CleanerConfig(
67
+ datetime_columns=("joined",),
68
+ add_missing_indicators=True,
69
+ drop_constant_columns=True,
70
+ )
71
+
72
+ cleaner = DataCleaner(config).fit(train)
73
+ train_clean = cleaner.transform(train)
74
+ ```
75
+
76
+ `fit()` learns medians, modes, outlier bounds, category values, and datetime
77
+ rules from `train`. `transform()` applies those stored rules without learning
78
+ from the frame you pass in.
79
+
80
+ ## Leak-safe by construction
81
+
82
+ ```python
83
+ cleaner = DataCleaner(config).fit(X_train)
84
+
85
+ X_train_clean = cleaner.transform(X_train)
86
+ X_test_clean = cleaner.transform(X_test) # training rules only
87
+ ```
88
+
89
+ Never fit before splitting, and never create a new cleaner for test or
90
+ production data. See the [leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/)
91
+ for the full explanation.
92
+
93
+ ## What it handles
94
+
95
+ - numeric coercion, median / mean / constant imputation, and IQR capping
96
+ - categorical mode / constant imputation and a keep-or-fill unseen policy
97
+ - boolean coercion and imputation
98
+ - datetime parsing plus calendar feature extraction
99
+ - optional missing-value indicators and constant-column dropping
100
+ - declarative contracts with roles, allowed values, ranges, patterns, and uniqueness
101
+ - automatic train-schema contract inference and transform-time drift reports
102
+ - expectation checks and validation reports
103
+ - join diagnostics, referential integrity, and audited business-key dedup
104
+ - train/test split audits for duplicate, group, temporal, and target leakage
105
+ - joblib save / load, manifests, and stable data fingerprints
106
+ - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
107
+ - stable output schema and column order; inputs are never mutated and inference
108
+ rows are never dropped
109
+
110
+ ## Development
111
+
112
+ ```bash
113
+ git clone https://github.com/devlprkhan/universal-data-cleaner.git
114
+ cd universal-data-cleaner
115
+ uv sync --dev
116
+ uv run pytest -q
117
+ ```
118
+
119
+ Run the full quality gate:
120
+
121
+ ```bash
122
+ uv run ruff check .
123
+ uv run ruff format --check .
124
+ uv run mypy
125
+ uv run pytest
126
+ uv build
127
+ ```
128
+
129
+ Build or preview the docs:
130
+
131
+ ```bash
132
+ uv sync --group docs
133
+ uv run --group docs mkdocs serve
134
+ uv run --group docs mkdocs build --strict
135
+ ```
136
+
137
+ The reference notebook is `Universal_Data_Cleaner.ipynb`. Open it with:
138
+
139
+ ```bash
140
+ uv run jupyter lab Universal_Data_Cleaner.ipynb
141
+ ```
142
+
143
+ ## Project layout
144
+
145
+ ```text
146
+ src/data_cleaner/ # typed, pip-installable package
147
+ tests/ # unit and integration tests
148
+ docs/ # MkDocs guides, API page, and assets
149
+ mkdocs.yml # documentation site configuration
150
+ Universal_Data_Cleaner.ipynb # end-to-end reference workflow
151
+ pyproject.toml # package metadata and tooling
152
+ uv.lock # reproducible dependency lock
153
+ CHANGELOG.md # release notes
154
+ CONTRIBUTING.md # development workflow
155
+ SECURITY.md # vulnerability reporting
156
+ LICENSE # MIT license
157
+ ```
158
+
159
+ The package ships a `py.typed` marker, so `mypy`, `pyright`, and IDE tooling pick
160
+ up the type annotations automatically. Linting, formatting, type checking, tests,
161
+ the docs build, and package build run in CI.
162
+
163
+ ## Contributing
164
+
165
+ Contributions are welcome. See
166
+ [CONTRIBUTING.md](https://github.com/devlprkhan/universal-data-cleaner/blob/main/CONTRIBUTING.md)
167
+ for the local setup, quality gate, and pull-request expectations.
168
+
169
+ ## License
170
+
171
+ Released under the [MIT License](https://github.com/devlprkhan/universal-data-cleaner/blob/main/LICENSE).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "universal-data-cleaner"
7
- version = "2.5.0"
7
+ version = "2.5.2"
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",
@@ -1,4 +1,4 @@
1
1
  """Single source of truth for the package version."""
2
2
 
3
- __version__ = "2.5.0"
3
+ __version__ = "2.5.2"
4
4
  _ARTIFACT_VERSION = 2
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: universal-data-cleaner
3
+ Version: 2.5.2
4
+ Summary: Production-ready, scikit-learn-compatible data cleaning transformer for pandas.
5
+ Author: Haseeb Khan
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/devlprkhan/universal-data-cleaner
8
+ Project-URL: Documentation, https://devlprkhan.github.io/universal-data-cleaner/
9
+ Project-URL: Repository, https://github.com/devlprkhan/universal-data-cleaner
10
+ Project-URL: Issues, https://github.com/devlprkhan/universal-data-cleaner/issues
11
+ Project-URL: Changelog, https://github.com/devlprkhan/universal-data-cleaner/blob/main/CHANGELOG.md
12
+ Keywords: data-cleaning,data-quality,data-preprocessing,feature-engineering,machine-learning,pandas,scikit-learn,tabular-data
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Natural Language :: English
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: pandas>=2.2
30
+ Requires-Dist: numpy>=1.26
31
+ Requires-Dist: scikit-learn>=1.4
32
+ Requires-Dist: joblib>=1.3
33
+ Dynamic: license-file
34
+
35
+ # Universal Data Cleaner
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/)
39
+ [![PyPI](https://img.shields.io/pypi/v/universal-data-cleaner.svg)](https://pypi.org/project/universal-data-cleaner/)
40
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
41
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/devlprkhan/universal-data-cleaner/blob/main/LICENSE)
42
+ [![Managed with uv](https://img.shields.io/badge/managed%20with-uv-6f42c1.svg)](https://docs.astral.sh/uv/)
43
+
44
+ A small, production-oriented tabular cleaning transformer for pandas + scikit-learn.
45
+
46
+ It is designed for the part of an ML pipeline that is easy to get wrong: cleaning
47
+ training data and inference data with **exactly the same learned rules**.
48
+
49
+ ## Documentation
50
+
51
+ **[Full documentation →](https://devlprkhan.github.io/universal-data-cleaner/)**
52
+
53
+ The docs site is the central reference. This README is the short entry point.
54
+
55
+ | Guide | What it covers |
56
+ | --- | --- |
57
+ | [Quickstart](https://devlprkhan.github.io/universal-data-cleaner/quickstart/) | Install, first cleaner, scikit-learn pipeline |
58
+ | [Leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/) | The fit/transform contract and common mistakes |
59
+ | [Cleaning data](https://devlprkhan.github.io/universal-data-cleaner/cleaning/) | Config, roles, imputation, outliers, datetimes |
60
+ | [Contracts & drift](https://devlprkhan.github.io/universal-data-cleaner/contracts/) | `ColumnSpec`, `DataContract`, drift checks |
61
+ | [Validation, joins & dedup](https://devlprkhan.github.io/universal-data-cleaner/validation-joins/) | Expectations, join diagnostics, integrity, dedup |
62
+ | [ML split audit](https://devlprkhan.github.io/universal-data-cleaner/ml-split-audit/) | Duplicate, group, temporal, and target leakage |
63
+ | [Artifacts & reproducibility](https://devlprkhan.github.io/universal-data-cleaner/artifacts/) | Decision log, manifests, fingerprints, save/load |
64
+ | [Production guide](https://devlprkhan.github.io/universal-data-cleaner/production/) | Deployment checklist and failure modes |
65
+ | [API reference](https://devlprkhan.github.io/universal-data-cleaner/api/) | Generated from the package docstrings |
66
+ | [Changelog](https://devlprkhan.github.io/universal-data-cleaner/changelog/) | Release notes |
67
+
68
+ ## Install
69
+
70
+ ```bash
71
+ pip install universal-data-cleaner
72
+ ```
73
+
74
+ ```bash
75
+ uv add universal-data-cleaner
76
+ ```
77
+
78
+ The distribution name is `universal-data-cleaner`; the import name is
79
+ `data_cleaner`.
80
+
81
+ ```python
82
+ from data_cleaner import CleanerConfig, DataCleaner
83
+ ```
84
+
85
+ ## Quick start
86
+
87
+ ```python
88
+ import pandas as pd
89
+ from data_cleaner import CleanerConfig, DataCleaner
90
+
91
+ train = pd.DataFrame(
92
+ {
93
+ "age": [34, 41, None, 29],
94
+ "salary": [70_000, 82_000, 91_000, 55_000],
95
+ "dept": ["IT", "HR", "IT", None],
96
+ "joined": ["2022-01-03", "2021-11-20", "2023-04-01", "bad-date"],
97
+ }
98
+ )
99
+
100
+ config = CleanerConfig(
101
+ datetime_columns=("joined",),
102
+ add_missing_indicators=True,
103
+ drop_constant_columns=True,
104
+ )
105
+
106
+ cleaner = DataCleaner(config).fit(train)
107
+ train_clean = cleaner.transform(train)
108
+ ```
109
+
110
+ `fit()` learns medians, modes, outlier bounds, category values, and datetime
111
+ rules from `train`. `transform()` applies those stored rules without learning
112
+ from the frame you pass in.
113
+
114
+ ## Leak-safe by construction
115
+
116
+ ```python
117
+ cleaner = DataCleaner(config).fit(X_train)
118
+
119
+ X_train_clean = cleaner.transform(X_train)
120
+ X_test_clean = cleaner.transform(X_test) # training rules only
121
+ ```
122
+
123
+ Never fit before splitting, and never create a new cleaner for test or
124
+ production data. See the [leak-safe workflow](https://devlprkhan.github.io/universal-data-cleaner/leak-safe-workflow/)
125
+ for the full explanation.
126
+
127
+ ## What it handles
128
+
129
+ - numeric coercion, median / mean / constant imputation, and IQR capping
130
+ - categorical mode / constant imputation and a keep-or-fill unseen policy
131
+ - boolean coercion and imputation
132
+ - datetime parsing plus calendar feature extraction
133
+ - optional missing-value indicators and constant-column dropping
134
+ - declarative contracts with roles, allowed values, ranges, patterns, and uniqueness
135
+ - automatic train-schema contract inference and transform-time drift reports
136
+ - expectation checks and validation reports
137
+ - join diagnostics, referential integrity, and audited business-key dedup
138
+ - train/test split audits for duplicate, group, temporal, and target leakage
139
+ - joblib save / load, manifests, and stable data fingerprints
140
+ - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
141
+ - stable output schema and column order; inputs are never mutated and inference
142
+ rows are never dropped
143
+
144
+ ## Development
145
+
146
+ ```bash
147
+ git clone https://github.com/devlprkhan/universal-data-cleaner.git
148
+ cd universal-data-cleaner
149
+ uv sync --dev
150
+ uv run pytest -q
151
+ ```
152
+
153
+ Run the full quality gate:
154
+
155
+ ```bash
156
+ uv run ruff check .
157
+ uv run ruff format --check .
158
+ uv run mypy
159
+ uv run pytest
160
+ uv build
161
+ ```
162
+
163
+ Build or preview the docs:
164
+
165
+ ```bash
166
+ uv sync --group docs
167
+ uv run --group docs mkdocs serve
168
+ uv run --group docs mkdocs build --strict
169
+ ```
170
+
171
+ The reference notebook is `Universal_Data_Cleaner.ipynb`. Open it with:
172
+
173
+ ```bash
174
+ uv run jupyter lab Universal_Data_Cleaner.ipynb
175
+ ```
176
+
177
+ ## Project layout
178
+
179
+ ```text
180
+ src/data_cleaner/ # typed, pip-installable package
181
+ tests/ # unit and integration tests
182
+ docs/ # MkDocs guides, API page, and assets
183
+ mkdocs.yml # documentation site configuration
184
+ Universal_Data_Cleaner.ipynb # end-to-end reference workflow
185
+ pyproject.toml # package metadata and tooling
186
+ uv.lock # reproducible dependency lock
187
+ CHANGELOG.md # release notes
188
+ CONTRIBUTING.md # development workflow
189
+ SECURITY.md # vulnerability reporting
190
+ LICENSE # MIT license
191
+ ```
192
+
193
+ The package ships a `py.typed` marker, so `mypy`, `pyright`, and IDE tooling pick
194
+ up the type annotations automatically. Linting, formatting, type checking, tests,
195
+ the docs build, and package build run in CI.
196
+
197
+ ## Contributing
198
+
199
+ Contributions are welcome. See
200
+ [CONTRIBUTING.md](https://github.com/devlprkhan/universal-data-cleaner/blob/main/CONTRIBUTING.md)
201
+ for the local setup, quality gate, and pull-request expectations.
202
+
203
+ ## License
204
+
205
+ Released under the [MIT License](https://github.com/devlprkhan/universal-data-cleaner/blob/main/LICENSE).