Skip to main content

df-enrich

CI Python 3.9+

Pandas DataFrame accessor for schema-driven validation, derived columns, lookups, and profiling—powered by df-eval.

Features

  • 🔍 Validation: Schema-driven validation using Pandera
  • 🔧 Derivation: Create derived columns using expressions (via df-eval Engine)
  • 📊 Profiling: Generate data profiles with ydata-profiling
  • 🔗 Lookups: Enrich data with external sources
  • ⛓️ Chaining: Fluent API for method chaining
  • 📝 Provenance: Track operations in DataFrame.attrs
  • 🎯 Type Casting: Convenient dtype conversions

Installation

Using uv (recommended):

uv pip install df-enrich

Using pip:

pip install df-enrich

With optional dependencies:

# For documentation
uv pip install "df-enrich[docs]"

# For testing
uv pip install "df-enrich[test]"

Quick Start

import pandas as pd
import pandera as pa
from df_enrich import EnrichAccessor

# Create a DataFrame
df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]})

# Validate with Pandera
schema = pa.DataFrameSchema({
    "a": pa.Column(int),
    "b": pa.Column(int)
})
df_validated = df.enrich.validate(schema)

# Derive new columns
df_enriched = df.enrich.derive({"c": "a + b", "d": "a * b"})

# Chain operations
result = (df.enrich
          .validate(schema)
          .enrich.derive({"total": "a + b"})
          .enrich.cast({"total": "int32"}))

Usage

Validation

import pandera as pa

class MySchema(pa.DataFrameModel):
    col1: int
    col2: float

df.enrich.validate(MySchema)

Derive Columns

# From dictionary
df.enrich.derive({"total": "price * quantity"})

# From YAML string
df.enrich.derive("""
total: "price * quantity"
discount: "total * 0.1"
""")

# From YAML file
df.enrich.derive("derivations.yaml")

Profiling

# Generate profile report
profile = df.enrich.profile(engine="ydata")

# Lazy profiling
profile = df.enrich.profile(engine="ydata", lazy=True)

Lookups

# Lookup from DataFrame
prices = pd.DataFrame({"price": [10, 20, 30]})
df.enrich.lookup(prices, dst="price")

# Custom resolver
def my_resolver(df, src, dst):
    df[dst] = fetch_from_api(df)
    return df

df.enrich.lookup(None, dst="data", resolver=my_resolver)

Configuration

# Configure registries, secrets, etc.
df.enrich.config(registry_url="https://api.example.com")

Development

Setup

# Clone repository
git clone https://github.com/elphick/df-enrich.git
cd df-enrich

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create virtual environment and install dependencies
uv venv
uv pip install -e ".[test,docs]"

Running Tests

uv run pytest tests/ -v --cov=df_enrich

Building Documentation

cd docs
uv run sphinx-build -b html . _build/html

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for df-enrich 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for df-enrich 0.1.1
File Size Uploaded Provenance Actions
df_enrich-0.1.1.tar.gz 89.2 kB With provenance Details for df_enrich-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for df-enrich 0.1.1
File Interpreter ABI Platform Actions
df_enrich-0.1.1-py3-none-any.whl Python 3 none any Details for df_enrich-0.1.1-py3-none-any.whl

Total release size: 96.3 kB

Release files / df_enrich-0.1.1.tar.gz

Download URL df_enrich-0.1.1.tar.gz
Size 89.2 kB
Tags Source
SHA-256 checksum
How to use checksums
db458037835ab3e21fd4196271811888ac87f6fc5ba8036f6050258443b2182c
BLAKE2b-256 checksum
How to use checksums
5f80c475519b1ca2ee906d168510c838fd554be628e3cb0efc434aac316f0c27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / df_enrich-0.1.1-py3-none-any.whl

Download URL df_enrich-0.1.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f80285f1e88dc0b6bef4483d05ebf52a95f5e37c9b8af3cb023a772cb46f71e
BLAKE2b-256 checksum
How to use checksums
0cdeaa410136b91b1253df7c2ad57f49e2a1d01a33479900a22a621a2e352aeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for df-enrich 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for df_enrich-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page