Skip to main content
freshdata logo

freshdata

The explainable cleaning layer for pandas — decision-preserving data hygiene.

One call turns a messy CSV, Excel, or SQL export into analysis- and ML-ready data, and tells you exactly what it changed and why.

PyPI Version Python Versions License: MIT CI Docs Coverage Benchmarks

Documentation · Quickstart · API Reference · Changelog

Overview

freshdata is an automated data-cleaning library for Python. It is not a fillna wrapper: a rule-based decision engine profiles every column — missing ratio, dtype, skewness, cardinality, inferred role — and chooses the right action per column. Every decision carries a rationale, a risk level, and a confidence score, so nothing happens silently and nothing is left unexplained.

It fills the gap between tools that only describe data (ydata-profiling) or only validate it (Great Expectations): freshdata makes the cleaning decision and shows its work, producing reproducible, auditable, ML-ready output.

It's aimed at data scientists, analytics engineers, and ML practitioners who are tired of hand-rolling the same missing-value/outlier/dtype boilerplate for every new dataset and want an audit trail they can hand to a reviewer.

Key features

  • One-call cleaningfd.clean(df) handles missing values, outliers, duplicates, dtype repair, and messy column names.
  • Per-column decision engine — infers each column's role and applies explicit, documented rules instead of one blunt global strategy.
  • Explainable by design — every action carries a rationale, risk level, and confidence score; if a NaN survives, the report says why.
  • Safe defaults — never imputes an identifier, modifies a target column, or removes outliers blindly.
  • pandas-first, Polars-optional — pandas + NumPy core; pass a Polars frame and get one back, with optional Polars/DuckDB/Spark execution backends for larger-than-memory data.
  • CLI includedclean, plan, apply-plan, profile, learn, and trust subcommands for scripting and CI pipelines without writing Python.
  • Typed, tested, fast — fully type-hinted (py.typed), vectorized, with a 93% coverage gate enforced in CI.

Installation

pip install freshdata-cleaner

The PyPI distribution is freshdata-cleaner; the import name is freshdata.

Requires Python >= 3.9 and pandas >= 1.5.

Most functionality beyond core cleaning ships as optional extras:

Extra Adds
ml KNN/model-based imputation
polars Polars DataFrame support
duckdb Out-of-core execution via DuckDB
spark Out-of-core execution via PySpark
viz Interactive HTML report rendering
privacy PII detection and anonymization
enterprise Compliance reporting, orchestration hooks, quality-ops exporters
all Everything above
pip install "freshdata-cleaner[ml,polars]"

See the installation guide for the full list of extras (domain packs, format parsers, streaming, entity resolution, and more).

Quickstart

import pandas as pd
import freshdata as fd

df = pd.read_csv("messy_export.csv")

cleaned = fd.clean(df)                               # one line
cleaned, report = fd.clean(df, return_report=True)   # ... with a full audit trail
print(report.summary())
freshdata clean report
  rows:    525 -> 500 (-25)
  columns: 7 -> 6 (-1)
  missing: 421 -> 0 cell(s)
  memory:  100.8 KB -> 89.2 KB

The same operation is available from the command line:

freshdata clean messy_export.csv -o clean.csv --report audit.json

Usage examples

The examples/ directory has runnable, self-contained scripts. A few starting points:

See examples/README.md for the complete, indexed list.

Project structure

freshdata/
├── src/freshdata/     # library source (engine, domains, enterprise, execution backends, CLI)
├── tests/             # pytest suite
├── examples/          # runnable usage examples
├── docs/              # mkdocs-material documentation site
├── benchmarks/         # CleanBench accuracy/performance benchmark harness
└── crates/            # optional Rust acceleration crate (freshcore)

CLI reference

Installing the package provides a freshdata command with several subcommands:

Command Purpose
clean Clean a file and optionally write a JSON audit report
plan / apply-plan Suggest a reviewable repair plan, then apply exactly the approved actions
profile Print a read-only profile of a file, or audit/diff/merge .fdprofile files
learn Learn a reusable cleaning profile from a (messy, clean) file pair
trust Print the Data Trust Score of a file
quality-ops Export a report to dbt/Great Expectations/exception-table/lineage artifacts
policy compile Compile natural-language cleaning rules into a reviewable policy
models status / models pull Manage optional local semantic models

Run freshdata <command> --help for the full option list, or see the quickstart guide for CLI usage.

Development setup

git clone https://github.com/FreshCode-Org/freshdata.git
cd freshdata
python -m venv .venv && source .venv/bin/activate

pip install -e ".[dev,ml]"

pytest -m "not online and not large"   # fast lane, matches CI
ruff check src tests                   # lint
mypy src/freshdata                     # typecheck

pre-commit hooks are configured in .pre-commit-config.yaml; run pre-commit install after cloning to have them run automatically.

Contributing

Contributions are welcome. The workflow is the standard GitHub flow: fork, create a branch, make your change, add or update tests, and open a pull request. CI runs linting (ruff), type checking (mypy), and the fast pytest lane on every PR.

See CONTRIBUTING.md for full details, including how to work with the online-fixture test registry, and CODE_OF_CONDUCT.md for community guidelines.

Roadmap

freshdata is under active development; see CHANGELOG.md for what has shipped and the issue tracker for what's being discussed.

License

MIT — see LICENSE.

Download files

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

Source Distribution

freshdata_cleaner-1.1.1.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

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

freshdata_cleaner-1.1.1-py3-none-any.whl (628.1 kB view details)

Uploaded Python 3

File details

Details for the file freshdata_cleaner-1.1.1.tar.gz.

File metadata

  • Download URL: freshdata_cleaner-1.1.1.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for freshdata_cleaner-1.1.1.tar.gz
Algorithm Hash digest
SHA256 0e2a078be2c332ba5d5937e6cbbd2ccb0c79a67f9b15c85362542e4a5d393416
MD5 a0708f282cb737426b1183d8555e0a1a
BLAKE2b-256 8f79bb35b1c1f5f655d07197835d637aa43688964a1bdad864a7870b6266e510

See more details on using hashes here.

Provenance

The following attestation bundles were made for freshdata_cleaner-1.1.1.tar.gz:

Publisher: release.yml on FreshCode-Org/freshdata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freshdata_cleaner-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for freshdata_cleaner-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53b7a179648605b69ce10bd4ece0d39a70bd40898cc404c09ff4c22a10fe972c
MD5 6ed889c628925090407b14d356cc2ada
BLAKE2b-256 7c8212901801ee879cc0e91ea66304b928bdb58b2f0d666ce7caa778d61a37ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for freshdata_cleaner-1.1.1-py3-none-any.whl:

Publisher: release.yml on FreshCode-Org/freshdata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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