Skip to main content

Data trust for Python. Validate, clean, and profile DataFrames before everything else.

Project description

arnio

Data trust for Python.

Validate, clean, and profile DataFrames before everything else.

PyPI Python License: MIT


What is Arnio?

Arnio is the data trust layer for Python. It answers one question:

"Is this data trustworthy?"

It answers through three verbs: validate, clean, and profile.

Think of it as Pydantic for DataFrames.

Install

pip install arnio

Quick Start

import arnio as ar
import pandas as pd

df = pd.DataFrame({
    "email": ["alice@example.com", "not-an-email", None],
    "age": [25, -5, 200],
    "name": ["Alice", "Bob", "Charlie"],
})

# Profile — instant data quality overview
report = ar.profile(df)
print(report.quality_score)  # 0–100

# Validate — check against a schema
schema = ar.Schema({
    "email": ar.Email(nullable=False),
    "age": ar.Int(min=0, max=150),
    "name": ar.String(min_length=1),
})
result = ar.validate(df, schema)
print(result.passed)   # False
print(result.issues)   # Structured list of issues

# Clean — declarative cleaning pipeline
cleaned = ar.clean(df, [
    "strip_whitespace",
    "drop_duplicates",
    ("normalize_case", {"case": "lower"}),
])

# Suggest — intelligent cleaning suggestions
suggestions = ar.suggest(df)

Three Core Verbs

Verb Function Purpose
Validate ar.validate(df, schema) Check if data matches a contract
Clean ar.clean(df, steps) Apply declarative cleaning operations
Profile ar.profile(df) Measure data quality with scores and metrics

Schema Definition

Two ways to define the same schema:

# Dict-based (dynamic, config-driven)
schema = ar.Schema({
    "email": ar.Email(nullable=False),
    "age": ar.Int(min=0, max=150),
    "name": ar.String(min_length=1),
})

# Class-based (IDE-friendly, inheritable)
class Customers(ar.Schema):
    email = ar.Email(nullable=False)
    age = ar.Int(min=0, max=150)
    name = ar.String(min_length=1)

Available Field Types

Type Description
ar.Int Integer with optional min/max
ar.Float Float with optional min/max
ar.String String with optional length/pattern
ar.Bool Boolean
ar.Date Date string with format validation
ar.DateTime DateTime string with format validation
ar.Email Email address
ar.URL HTTP/HTTPS URL
ar.PhoneNumber Phone number
ar.IPAddress IPv4 or IPv6 address
ar.UUID UUID string
ar.Regex Custom regex pattern

Cleaning Pipeline

# One-shot cleaning
cleaned = ar.clean(df, [
    "strip_whitespace",
    "drop_duplicates",
    ("fill_nulls", {"column": "category", "value": "unknown"}),
    "slugify_column_names",
])

# Reusable pipeline
pipe = ar.Pipeline([
    "strip_whitespace",
    "drop_duplicates",
    ("normalize_case", {"case": "lower"}),
])
cleaned = pipe.run(df)

# Save/load for version control
yaml_str = pipe.to_yaml()
pipe = ar.Pipeline.from_yaml(yaml_str)

Quality Gates (CI/CD)

# In a test file or CI script
ar.check(df, schema)  # Raises ar.ValidationError on failure

pandas Accessor

import arnio  # Registers the accessor

df.arnio.profile()
df.arnio.validate(schema)
df.arnio.clean(["strip_whitespace"])
df.arnio.suggest()
df.arnio.is_valid(schema)  # Returns bool

Works With

  • pandas DataFrames (primary)
  • dict / list of dicts (no pandas import needed for simple cases)
  • Polars DataFrames (v2.1)

What Arnio Does NOT Do

Arnio stays in its lane. It does not:

  • Query or filter data (use pandas/Polars)
  • Perform analytics (use pandas/Polars/DuckDB)
  • Do feature engineering (use scikit-learn)
  • Create visualizations (use matplotlib/Plotly)
  • Manage file formats (use PyArrow)

License

MIT — Anish Raj

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

arnio-2.0.0.tar.gz (39.1 MB view details)

Uploaded Source

Built Distribution

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

arnio-2.0.0-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file arnio-2.0.0.tar.gz.

File metadata

  • Download URL: arnio-2.0.0.tar.gz
  • Upload date:
  • Size: 39.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for arnio-2.0.0.tar.gz
Algorithm Hash digest
SHA256 cc509758b7b90f431ffe14622b13bccb0f2a1a83e50f7ab1c318f08014800938
MD5 1b4a2823ce36f2d1ed909d9614ce78fc
BLAKE2b-256 2b44b8d17ffa7db332813f953b22c1c709e7e8339e40e4b78fb41b4f86d5dcf4

See more details on using hashes here.

File details

Details for the file arnio-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: arnio-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for arnio-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 733a00015b7c65cc0bf26b546a3cc463bb2b8097795c763edb16db07da7ed766
MD5 a377fff355e527f5b9dd0dd0a622fc95
BLAKE2b-256 cde0fab08dabda88b8619c3e1e6c9bfe3f486ef0725687465c35fd4b7e95319e

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