Skip to main content

ML readiness auditor for tabular data with safe normalization and reproducible cleaning recipes

Project description

mlready

mlready is a lightweight Python library for making tabular datasets safe and ready for machine-learning pipelines.

It focuses on observation → risk detection → safe normalization, not aggressive automation.


Why mlready?

Real-world datasets fail ML pipelines because of:

  • numeric values stored as strings ("$1,200", "1.2M")
  • inconsistent booleans (Yes / no / YES / n)
  • datetime columns stored as text
  • unseen categories between train and test
  • silent data leakage and ID-like columns

mlready helps you detect these issues early and fix only what is safe.


Installation

pip install mlready

Core API (3 functions)

1️⃣ profile(df)

Purpose: Understand the dataset (read-only).

import mlready as mr

report = mr.profile(df)

What it provides:

  • dataset shape, memory usage, duplicates

  • per-column:

    • dtype and inferred logical type
    • missing counts and percentages
    • unique counts and percentages
    • top values
    • pattern hints (currency, boolean, datetime)

No data is modified.


2️⃣ audit(df, target=None, reference_df=None)

Purpose: Detect ML risks before training.

audit_report = mr.audit(df, target="label")

What it detects:

  • ID-like columns
  • zero-variance columns
  • high-cardinality categoricals
  • numeric / boolean / datetime stored as strings
  • potential target leakage
  • ghost categories (train vs test mismatch)
  • schema drift

Returns structured warnings, not guesses.


3️⃣ apply(df, recipe=None)

Purpose: Safely normalize raw data.

clean_df, recipe, report = mr.apply(df)

What it safely applies (v0.1):

  • currency / numeric string → numeric ("$1,200", "(50)", "1.2M")
  • boolean strings → boolean dtype (Yes / no / YES / n)
  • unambiguous datetime parsing
  • safe numeric downcasting (nullable-aware)

What it does NOT do:

  • no column dropping
  • no encoding
  • no fuzzy category merging
  • no feature engineering

All actions are recorded in a reproducible recipe.


Example

import pandas as pd
import mlready as mr

df = pd.DataFrame({
    "Price": ["$1,200", "1.2M"],
    "Membership": ["Yes", "no"],
})

clean, recipe, report = mr.apply(df)

print(clean)
print(report)

Output:

       Price  Membership
0     1200.0        True
1  1200000.0       False

Design Principles

  • Safety first – no silent destructive actions
  • Sampling-aware – fast on large data, reliable on small data
  • Pipeline-friendly – deterministic behavior via recipes
  • Minimal dependencies – pure pandas / numpy

When to use mlready

Use mlready when:

  • ingesting raw CSVs or business data
  • validating train vs test consistency
  • preparing data before encoding / modeling
  • building reproducible ML pipelines

Not intended to replace:

  • feature engineering libraries
  • AutoML tools
  • visualization-heavy EDA tools

Project Status

  • Version: 0.1.0
  • Stable core API
  • Tests included
  • Ready for production pipelines (safe mode)

License

MIT License


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlready-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlready-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file mlready-0.1.0.tar.gz.

File metadata

  • Download URL: mlready-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mlready-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7aa9ae13bae3367c474cbc096f225d985a1855f417ff7fbb4bc866e70cb50048
MD5 8044392c719b9b649469f323262ba8ec
BLAKE2b-256 34d4447306ea5e01fc311ccf0d99471d1bb39597925534826403d1961009bdd4

See more details on using hashes here.

File details

Details for the file mlready-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mlready-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mlready-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5eecd0b6350e4e1e9dcdefd55dba8230d1944574a3988c174a5960074b155990
MD5 1a4357875b7916b8e8fb2d6303c39168
BLAKE2b-256 10ba0e81efb3e146a9363d460ef57b924a5c5a3b998bb5796d1b05fc8d96c28e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page