-
-
Notifications
You must be signed in to change notification settings - Fork 390
Core Workflows
Arnio is designed around a simple flow:
- Read or scan data.
- Clean it with explicit steps.
- Profile quality.
- Validate against a schema.
- Hand off to pandas or another tool.
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")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"])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)suggestions = ar.suggest_cleaning(report)For a one-call workflow:
clean, report, explanation = ar.auto_clean(
frame,
return_report=True,
return_explanation=True,
)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.
Use diff_schema to compare expected and observed contracts.
diff = ar.diff_schema(expected_schema, observed_schema)
print(diff.to_markdown())df = ar.to_pandas(clean)Already using pandas? Use the accessor:
clean_df = df.arnio.clean([
("strip_whitespace",),
("drop_duplicates",),
])