Auto-detect and fix messy data in one function call
Project description
dataclean
Auto-detect and fix messy data in one function call.
Install
pip install dataclean-kuntal
Quick start
import dataclean as dc
clean_df, report = dc.clean("messy_data.csv")
report.summary()
What it fixes
| Problem | Example | Fix |
|---|---|---|
| Date format chaos | 2024-01-15, 15/01/2024, Jan 15 2024 |
Normalized to YYYY-MM-DD |
| Hidden nulls | "N/A", "null", "?", "-" |
Unified to real NaN |
| Mixed types | 25, "thirty", 25.0 |
Coerced to dominant type |
| Sneaky duplicates | John Smith vs john smith |
Fuzzy deduplication |
| Encoding errors | Jos\xef |
Repaired to José |
| Inconsistent labels | "USA", "US", "U.S.A" |
Merged via fuzzy matching |
| Column name mess | "First Name ", "AGE(Years)" |
Normalized to snake_case |
| Outliers | 9999999 in salary column |
Flagged with context |
API
import dataclean as dc
# clean any file or DataFrame
clean_df, report = dc.clean("data.csv")
clean_df, report = dc.clean("data.xlsx")
clean_df, report = dc.clean("data.json")
clean_df, report = dc.clean(df) # existing DataFrame
# use individual fixers
df = dc.fix_columns(df)
df = dc.fix_nulls(df)
df = dc.fix_dates(df)
df = dc.fix_duplicates(df, method="fuzzy")
df = dc.fix_categories(df)
df = dc.flag_outliers(df)
# audit report
report.summary() # print human-readable summary
report.to_df() # pandas DataFrame of all changes
report.to_dict() # list of dicts
report.changes_for("nulls") # filter by fixer
Options
clean_df, report = dc.clean(
source="data.csv",
fix="all", # or list: ["columns", "nulls", "dates"]
output="clean.csv", # optional save path
fuzzy_duplicates=True, # fuzzy deduplication
outlier_method="iqr", # "iqr" or "zscore"
category_threshold=85, # fuzzy match threshold
duplicate_threshold=85, # fuzzy dedup threshold
)
Author
KUNTALinGITHUB — Kuntal Pal, Independent Researcher, Kolkata, India
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dataclean_kuntal-0.1.2.tar.gz
(13.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dataclean_kuntal-0.1.2.tar.gz.
File metadata
- Download URL: dataclean_kuntal-0.1.2.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86db0c6109cfd4ed3e82e2cab7d1ff5a201de9f3c20f667447346c2aa768628e
|
|
| MD5 |
658b5eed3c01e0e78262bd5cc6fc5516
|
|
| BLAKE2b-256 |
7293561c92eeb989a8624ce74f68ee30104ee132283fe41a58466217afea386c
|
File details
Details for the file dataclean_kuntal-0.1.2-py3-none-any.whl.
File metadata
- Download URL: dataclean_kuntal-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4597579cd87bd579c820b28d5c5aab3a37282bd0c95ef81e70b3135467a7c4e4
|
|
| MD5 |
40429f68dacc1e871d170740290323d5
|
|
| BLAKE2b-256 |
ff3b37818a9a9c00f5646adbd3e4ef6d41f108a83ba7276ccfd323d7596711c6
|