🛡️ csvguard
The Fast, Terminal-First Data Quality Profiler & Cleaning CLI for Python.
Stop writing 40 lines of boilerplate Pandas code just to inspect missing values, bad headers, duplicate rows, and statistical outliers in messy CSV files.
csvguard gives you a CIBIL-style Data Health Score (0-100), an interactive terminal dashboard, and one-command automated data cleaning.
✨ Features
- 🩺 Instant Health Score (0-100): Comprehensive weighted evaluation of missing data ratios, duplicate rows, IQR outliers, and header hygiene.
- 🎨 Rich Terminal Dashboard: Color-coded tables, status indicators, and progress spinners directly inside your shell.
- 🧹 Automated Autonomous Cleaning: Drop duplicates, sanitize column headers to
snake_case, and impute missing numerical/categorical values with a single command. - 📈 Statistical Outlier Detection: Identifies extreme values using Tukey's Interquartile Range (IQR) fences.
- 📄 Markdown & CI/CD Export: Generate markdown audit reports suitable for GitHub PRs and automated data validation pipelines.
- ⚡ Dual Interface: Use as a standalone Command-Line Tool (
csvguard) or as a Python library (import csvguard).
🚀 Installation
Via PyPI (Recommended):
pip install csvguard
From Source (Local Development):
git clone https://github.com/your-username/csvguard.git
cd csvguard
pip install -e .
💻 CLI Usage
1. Audit a CSV File (Health Checkup):
csvguard audit data.csv
2. Auto-Clean and Sanitize Data:
csvguard clean messy.csv --auto -o cleaned.csv
This automatically:
- Sanitizes headers (
Annual Income➔annual_income) - Removes exact duplicate records
- Imputes missing numerical values with column medians
- Fills missing text fields with
'Unknown'
3. Generate a Markdown Documentation Report:
csvguard report data.csv -o DATA_QUALITY_REPORT.md
🐍 Python Library Usage
You can also import csvguard directly in your machine learning scripts or Jupyter Notebooks:
import csvguard as cg
# 1. Audit dataset
profile = cg.audit("samples/messy_sample.csv")
print(f"Health Score: {profile['health_score']}/100 ({profile['grade']})")
print(f"Duplicates: {profile['duplicates']}")
# 2. Clean dataset programmatically
res = cg.clean("samples/messy_sample.csv", output_path="clean.csv", impute_numeric="median")
print(f"Cleaned dataset saved to: {res['output_path']}")
📦 How to Publish to PyPI (For Maintainers)
- Build the distribution package:
python -m pip install --upgrade build twine
python -m build
- Upload to PyPI:
python -m twine upload dist/*
📄 License
Distributed under the MIT License.
Release files for csvguard 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| csvguard-0.1.0.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| csvguard-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / csvguard-0.1.0.tar.gz
| Download URL | csvguard-0.1.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf715850ec6a5e7a1f4b0293eae6ae6b43c46775953518bc1f62f9eb6bd70248
|
|
BLAKE2b-256 checksum How to use checksums |
836cb1f6ff92a361c607cb2c9983d5eb75615c156d3bdd164a5be1ed8eaf707c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / csvguard-0.1.0-py3-none-any.whl
| Download URL | csvguard-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70cba0ce0489e5c447685bce3a528ec71d64ae409fe3e9de1eda3f5861850f8e
|
|
BLAKE2b-256 checksum How to use checksums |
6957b8e44c180cfb2d467667d668c68d51a893ccdbeb0d2a0567fe660a954fca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|