Automated Data Preprocessing, Profiling, and Quality Reporting
Installation | Quick Start | Features | API Reference | Ecosystem
DataPrepToolkit is a production-quality Python package that automates the most common data preprocessing tasks performed before exploratory analysis, business intelligence reporting, or machine learning workflows.
Instead of writing repetitive cleaning code for every project, use DataPrepToolkit to:
- Load and profile your dataset in one line
- Validate data against business rules
- Clean missing values, duplicates, and invalid data
- Optimize memory usage with automatic type downcasting
- Detect outliers using statistical methods
- Report data quality with professional HTML/CSV exports
DataPrepToolkit is the first component of a modular data analysis ecosystem:
| Component | Purpose | Version |
|---|---|---|
| DataPrepToolkit | Data preprocessing, cleaning, validation | v1.1.0 |
| AutoEDA | Exploratory data analysis, visualization | v1.0.0 |
| AutoAnalytics | Statistical analysis, modelling | v1.0.0 |
| AutoBI | Dashboard generation, BI export | v1.0.0 |
| automation-core | Shared contracts and serialization | v0.1.0 |
Contract flow: DataPrepToolkit produces a PreprocessingResult contract that downstream packages consume via UpstreamReference.
pip install datapreptoolkitFor development:
git clone https://github.com/Arasoul/DataPrepToolkit.git
cd DataPrepToolkit
pip install -e ".[dev]"from datapreptoolkit import load_csv, generate_quality_report, export_html_report
# Load your data
df = load_csv("your_data.csv")
# Generate a complete quality report
report = generate_quality_report(df)
report.overall_quality_score # e.g. 95.54
# Export as professional HTML report
export_html_report(report, "reports/quality_report.html")from datapreptoolkit import load_csv, load_dataframe
df = load_csv("data.csv")
df = load_dataframe(your_df)from datapreptoolkit import profile_dataset
profile = profile_dataset(df)
profile.shape # (1000, 12)
profile.memory_human # "456.78 KB"
profile.overall_quality_score # 92.62from datapreptoolkit import validate_dataset, ValidationRule
rules = [
ValidationRule(column="age", rule_type="range", min_value=0, max_value=120),
ValidationRule(column="email", rule_type="regex", pattern=r"^[\w.-]+@[\w.-]+\.\w+$"),
ValidationRule(column="id", rule_type="no_duplicates"),
]
result = validate_dataset(df, rules)
result.is_valid # False
result.failed_rules # 1from datapreptoolkit import clean_dataset
df_final, result = clean_dataset(df)from datapreptoolkit import optimise_memory
df_optimized, result = optimise_memory(df)
result.savings_pct # 27.6from datapreptoolkit import detect_outliers
result = detect_outliers(df, method="iqr")
result.total_outliers # 15from datapreptoolkit import generate_quality_report, export_html_report
report = generate_quality_report(df)
export_html_report(report, "reports/quality_report.html")from datapreptoolkit.contracts import build_preprocessing_result
from datapreptoolkit._internal.models import RuntimeAnalysisState
state = RuntimeAnalysisState()
state.log_change("Cleaned data")
# Produces a PreprocessingResult contract for downstream packages
result = build_preprocessing_result(df, original_df=original_df, state=state)DataPrepToolkit/
├── src/datapreptoolkit/
│ ├── __init__.py # Public API
│ ├── _version.py # __version__ = "1.1.0"
│ ├── contracts.py # build_preprocessing_result adapter
│ ├── config.py # ToolkitConfig, enums
│ ├── exceptions.py # Custom exception hierarchy
│ ├── utils.py # Delegates to automation_core.utils
│ ├── loader.py # CSV/DataFrame loading, profiling
│ ├── analyzer.py # Missing values, numeric, categorical analysis
│ ├── cleaner.py # Imputation, deduplication, validation
│ ├── optimizer.py # Memory/dtype optimization
│ ├── outliers.py # IQR, Z-score outlier detection
│ ├── validator.py # Rule-based data validation
│ └── reporter.py # Quality scoring, HTML/CSV export
├── tests/ # 171 unit tests
├── pyproject.toml
├── LICENSE
└── README.md
load_csv(filepath, encoding)— Load CSV fileload_dataframe(df)— Load from existing DataFrameprofile_dataset(df, config)— Generate DatasetProfile
handle_missing_values(df, strategy, config)— Impute/drop missingremove_duplicates(df, subset, config)— Remove duplicate rowsclean_dataset(df, config)— Run full cleaning pipeline
optimise_datatypes(df, config)— Down-cast typesoptimise_memory(df, config)— High-level memory optimization
detect_outliers(df, method, config)— Auto-detect outliers
validate_dataset(df, rules, config)— Validate against rules
generate_quality_report(df, config)— Generate QualityReportexport_html_report(report, filepath, config)— Export HTMLexport_csv_summary(report, filepath, config)— Export CSV
build_preprocessing_result(df, original_df, state, upstream_ref)— BuildPreprocessingResult
python -m pytest tests/ -v
python -m pytest tests/ --cov=datapreptoolkit --cov-report=html- Python 3.11+
- pandas >= 2.1.0
- numpy >= 1.25.0
- automation-core >= 0.1.0
MIT License - see LICENSE for details.
Ahmed - GitHub