Skip to content

Core Workflows

Anish Raj edited this page May 23, 2026 · 1 revision

Core Workflows

Arnio is designed around a simple flow:

  1. Read or scan data.
  2. Clean it with explicit steps.
  3. Profile quality.
  4. Validate against a schema.
  5. Hand off to pandas or another tool.

CSV Loading

Use read_csv when you want data loaded into an ArFrame.

frame = ar.read_csv("data.csv")

Use mode="permissive" when malformed trailing rows should be padded instead of rejected.

frame = ar.read_csv("data.csv", mode="permissive")

Use scan_csv when you only need inferred column types.

schema = ar.scan_csv("large.csv")

Declarative Cleaning

Use pipeline when the cleaning steps should be reproducible and reviewable.

ops = [
    ("strip_whitespace",),
    ("normalize_case", {"case_type": "title"}),
    ("fill_nulls", {"value": "Unknown", "subset": ["city"]}),
    ("drop_duplicates",),
]

clean = ar.pipeline(frame, ops)

Use dry_run=True to validate a pipeline configuration without returning transformed output.

ar.pipeline(frame, ops, dry_run=True)

Use return_metadata=True to inspect step timings and row-count changes.

clean, metadata = ar.pipeline(frame, ops, return_metadata=True)
print(metadata["step_timings"])
print(metadata["row_counts"])

Quality Profiling

report = ar.profile(clean)
print(report.summary())
print(report.to_markdown())

For high-cardinality string columns, approx_top_values=True can keep profiling practical on larger datasets.

report = ar.profile(clean, approx_top_values=True)

Cleaning Suggestions

suggestions = ar.suggest_cleaning(report)

For a one-call workflow:

clean, report, explanation = ar.auto_clean(
    frame,
    return_report=True,
    return_explanation=True,
)

Schema Validation

schema = ar.Schema({
    "name": ar.String(nullable=False),
    "age": ar.Int64(nullable=True, min=0, max=120),
    "email": ar.Email(nullable=False),
})

result = ar.validate(clean, schema)

Validation issues use 1-based row indexes for data rows. The header row is not counted.

Schema Diff

Use diff_schema to compare expected and observed contracts.

diff = ar.diff_schema(expected_schema, observed_schema)
print(diff.to_markdown())

pandas Handoff

df = ar.to_pandas(clean)

Already using pandas? Use the accessor:

clean_df = df.arnio.clean([
    ("strip_whitespace",),
    ("drop_duplicates",),
])

Clone this wiki locally