Skip to content

About

๐Ÿงฌ DatasetDNA: Fast, zero-dependency Python CLI to instantly profile, validate, and detect anomalies in CSV & Parquet dataset

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฌ DatasetDNA

One command. Know your dataset before you train.

PyPI Python License Tests Release

DatasetDNA is an automated dataset health profiler for machine learning. It analyzes your CSV, detects real data-quality problems, separates them from statistical signals, identifies targets, calculates a 0โ€“100 health score, and provides actionable recommendations.

๐Ÿ›ก๏ธ Your data stays on your machine. No cloud upload. No notebook required. No configuration required.


โšก Quick Start

pip install datasetdna
datasetdna your_data.csv
datasetdna data.csv --target churn
datasetdna data.csv --html

๐ŸŽฏ The Core Idea

Not every unusual pattern is a data-quality problem.

DatasetDNA makes a strict distinction between data quality and statistical signals.

๐Ÿงฌ Data Quality ๐Ÿ“Š Statistical Signals
Affects Health Score Does not affect Health Score
Missing values Strong correlations
Duplicate rows Skewness
Target imbalance High cardinality
Impossible values Statistical outliers

For example, petal_length โ†” petal_width = 0.96 is not automatically a problem. A statistical pattern can simply describe a real property of the data.

A statistical pattern is not automatically a data-quality defect.


๐Ÿ” What DatasetDNA Checks

๐Ÿ“‹ Overview

Row count, column count, memory usage, missing cells, and duplicate rows.

๐Ÿงฑ Schema & Semantic Types

Numeric, categorical, boolean, date, ID-like, and empty columns.

โš ๏ธ Missing Values

Detects normal and disguised missing values such as NaN, N/A, null, NULL, ?, -, and unknown.

๐Ÿ” Duplicates

Detects duplicate rows and their proportion.

๐Ÿ”ข Cardinality

Measures unique values and identifies unusually high-cardinality columns.

๐Ÿ“ˆ Numerical Analysis

Mean, median, standard deviation, minimum, maximum, and skewness.

๐Ÿท๏ธ Categorical Analysis

Category counts, percentages, associations, and binary variables.

๐Ÿ“Œ Outliers

Statistical outliers with domain-aware rules where appropriate.

๐Ÿ”— Correlations

Strong numerical relationships using Pearson correlation.

๐ŸŽฏ Target Analysis

Classification and regression detection, class counts, distributions, and imbalance ratios for classification.

๐Ÿงฉ Mixed-Type Detection

Identifies columns containing multiple underlying Python value types, such as numbers mixed with strings.

๐Ÿท๏ธ Category Consistency

Detects multiple representations of the same category, such as Male, male, and M.


๐Ÿง  Semantic Type Detection

DatasetDNA goes beyond df.describe() and tries to understand what columns represent.

customer_id    โ†’ ID
age            โ†’ Numeric
income         โ†’ Numeric
city           โ†’ Categorical
joined_at      โ†’ Date
churn          โ†’ Target

It also handles messy values such as $55,000, 1,200, N/A, null, ?, and -.

ID-like columns can be excluded from statistical analysis where they would otherwise create misleading relationships.


โค๏ธ Health Score

Every dataset receives a 0โ€“100 Health Score.

100 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Excellent
 80 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Good
 60 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Fair
 40 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Poor
  0 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Critical

Score-affecting issues

  • Missing values
  • Duplicate rows
  • Target class imbalance
  • Impossible/domain-invalid values

Informational signals

  • Correlation
  • Skewness
  • Cardinality
  • Statistical outliers

Mixed-type and category-consistency findings are surfaced as recommendations and do not directly penalize the health score.

The score focuses on genuine data-quality concerns rather than penalizing valid statistical structure.


๐Ÿ–ฅ๏ธ Example Output

datasetdna examples/real.csv
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿงฌ Dataset Health โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ ๐ŸŸ  Health Score                               โ”‚
โ”‚                                               โ”‚
โ”‚ 70 / 100                                      โ”‚
โ”‚ Fair                                          โ”‚
โ”‚                                               โ”‚
โ”‚ 6 quality issue(s) ยท 14 statistical signal(s) โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿงฌ DATA QUALITY
 MEDIUM  Column 'age' contains 10.0% missing values.
 MEDIUM  Dataset contains 5.0% duplicate rows.
 HIGH    Age-like column 'age' contains values outside 0-120.

๐Ÿ“Š STATISTICAL SIGNALS
 ๐Ÿ”Ž HIGH    Strong correlation detected between age and salary.
 ๐Ÿ”Ž MEDIUM  Column 'customer_id' has very high cardinality.

๐ŸŽฏ Target Detection

Explicit target:

datasetdna data.csv --target churn

Automatic target detection checks:

target โ†’ label โ†’ churn

For classification, DatasetDNA reports class count, distribution, percentages, and imbalance ratio.

For regression, continuous targets are identified as regression targets and classification-specific metrics are not applied.


๐Ÿ’ก Recommendations

DatasetDNA generates recommendations from detected dataset conditions.

๐ŸŸก MEDIUM

Target 'churn' has an imbalance ratio of 4:1.

Recommendation:
Use stratified splitting and monitor
class-aware evaluation metrics.

Recommendations also flag mixed Python value types and inconsistent categorical representations so they can be standardized before model training.

Recommendations guide investigation rather than blindly applying one universal fix.


๐Ÿ Python API

Profile a pandas DataFrame directly in memory:

import pandas as pd
import datasetdna as dna

df = pd.DataFrame({
    "age": [20, 21, 22, 23],
    "income": [100, 200, 300, 400],
    "churn": [0, 0, 1, 1],
})

result = dna.profile(df)

Specify a target:

result = dna.profile(df, target="churn")

Generate an HTML report:

result = dna.profile(
    df,
    target="churn",
    html=True,
    output="datasetdna_report.html",
)

Access results:

print(result["health"])
print(result["target"])
print(result["recommendations"])

The result contains:

overview
schema
mixed_types
category_consistency
missing
duplicates
cardinality
numerical
categorical
outliers
correlations
target
health
recommendations

The CLI and Python API use the same underlying profiling engine.


๐Ÿ—๏ธ Architecture

                         DatasetDNA
                              โ”‚
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚                         โ”‚
                CLI                   Python API
                 โ”‚                         โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ–ผ
                       Profiling Engine
                              โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ               โ–ผ                โ–ผ
          Profilers      Health Score    Recommendations
              โ”‚
              โ”œโ”€โ”€ Overview
              โ”œโ”€โ”€ Schema
              โ”œโ”€โ”€ Mixed Types
              โ”œโ”€โ”€ Category Consistency
              โ”œโ”€โ”€ Missing
              โ”œโ”€โ”€ Duplicates
              โ”œโ”€โ”€ Cardinality
              โ”œโ”€โ”€ Numerical
              โ”œโ”€โ”€ Categorical
              โ”œโ”€โ”€ Outliers
              โ”œโ”€โ”€ Correlations
              โ””โ”€โ”€ Target
                              โ”‚
                              โ–ผ
                    Console / HTML Report

โšก Installation

From PyPI

pip install datasetdna

To install the current published release explicitly:

pip install datasetdna==1.1.0

From Source

git clone https://github.com/KAVYA-29-ai/DatasetDNA.git
cd DatasetDNA
pip install -e .

Requires Python 3.10+.


๐Ÿงช Testing

Automated coverage includes profilers, semantic types, target detection, health scoring, recommendations, CLI behavior, HTML reporting, Python API behavior, mixed-type detection, category consistency, and edge cases.

137 tests passed

Run the suite:

pytest -q

๐Ÿค” Why DatasetDNA?

Most ML failures aren't model failures. They're data failures:

โŒ Hidden missing values
โŒ Duplicate rows
โŒ Numeric values stored as strings
โŒ Impossible values
โŒ ID columns treated as features
โŒ Severe target imbalance
โŒ Mixed Python value types
โŒ Inconsistent category representations
โŒ Statistical patterns mistaken for data problems

DatasetDNA is designed as a pre-flight check for machine learning datasets.

Raw Dataset
     โ†“
 DatasetDNA
     โ†“
 Understand
     โ†“
   Fix
     โ†“
 Validate
     โ†“
  Train

๐Ÿ—บ๏ธ Roadmap

โœ… Phase 1 โ€” Core Profiler

  • Semantic type detection
  • Missingness analysis
  • Duplicate detection
  • Cardinality analysis
  • Numerical analysis
  • Categorical analysis
  • Outlier detection
  • Correlation analysis
  • Target analysis
  • Two-tier health scoring

โœ… Phase 2 โ€” Better UX

  • Actionable recommendations
  • Expanded validation
  • Automatic target detection
  • Large-file handling
  • Deeper test coverage
  • Mixed-type detection
  • Category consistency detection

โœ… Phase 3 โ€” HTML Dashboard

  • Interactive Plotly charts
  • Exportable HTML reports
  • Dataset health visualization
  • Target visualization
  • Category consistency section

โœ… Phase 4 โ€” Public Release

  • PyPI package
  • CLI
  • Python API
  • Stable 1.0.0 release
  • 1.1.0 release

๐Ÿ”ฎ Phase 5 โ€” Ecosystem

  • Expanded integrations
  • More edge-case coverage
  • API extensions
  • ML pipeline integrations

๐Ÿค Contributing

Issues and pull requests are welcome.

If DatasetDNA crashes, detects the wrong type, misses a real issue, or produces unexpected output, please open an issue with:

  • Dataset shape
  • Column names
  • Relevant data types
  • Expected behavior
  • Actual behavior

Please don't upload private or sensitive dataset contents.


๐Ÿ“„ License

DatasetDNA is released under the MIT License.

Copyright ยฉ Kavya Rajput


๐Ÿงฌ DatasetDNA

Profile better. Fix earlier. Train smarter.

About

๐Ÿงฌ DatasetDNA: Fast, zero-dependency Python CLI to instantly profile, validate, and detect anomalies in CSV & Parquet dataset

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages