Skip to main content

Crate datarust_profile

Crate datarust_profile 

Source
Expand description

§datarust-profile

One-call data profiling and data-quality reports for the datarust ecosystem.

datarust-profile takes a numeric datarust::Matrix, a categorical datarust::StrMatrix, or a mixed table of both, and produces a DatasetProfile describing shape, memory footprint, duplicate rows, per-column descriptive statistics (mean, std, five-number summary, cardinality, top value) and a list of data-quality findings. Profiles can be rendered to JSON (via the serde feature) or to a self-contained HTML report with no extra dependencies.

§Quick start

use datarust::Matrix;
use datarust_profile::{profile_matrix, report};

let m = Matrix::from_rows(vec![
    vec![1.0, 10.0],
    vec![2.0, 12.0],
    vec![3.0, f64::NAN],
]).unwrap();

let profile = profile_matrix(&m, None).unwrap();
println!("{}x{}, {} duplicates",
    profile.n_rows, profile.n_columns, profile.duplicate_rows);

// HTML report (always available, no extra deps):
let html = report::to_html(&profile);
std::fs::write("profile.html", html).unwrap();

§JSON output (feature serde)

Requires the serde feature. The example below is marked ignore so that it is not compiled by cargo test --doc when serde is disabled.

use datarust::Matrix;
use datarust_profile::{profile_matrix, report};

let m = Matrix::from_rows(vec![vec![1.0]]).unwrap();
let profile = profile_matrix(&m, None).unwrap();
let json = report::to_json(
    &report::JsonReport::from_profile(&profile),
).unwrap();
std::fs::write("profile.json", json).unwrap();

Re-exports§

pub use error::ProfileError;
pub use error::Result;
pub use profile::CategoricalStats;
pub use profile::ColumnProfile;
pub use profile::DatasetProfile;
pub use profile::FiveNumber;
pub use profile::Histogram;
pub use profile::NumericStats;
pub use quality::QualityIssue;
pub use quality::QualityKind;
pub use quality::Thresholds;
pub use types::ColumnType;
pub use types::Severity;

Modules§

error
Error types returned by datarust-profile.
infer
Column-type inference for string-typed data.
profile
Dataset and column profiling.
quality
Data-quality checks and findings.
report
Report renderers for a crate::DatasetProfile.
types
Shared value types used across the profiling modules.

Functions§

profile_matrix
Profiles a numeric Matrix.
profile_str_matrix
Profiles a string StrMatrix, inferring each column’s type.
profile_table
Profiles a mixed table: a numeric Matrix block followed by a categorical StrMatrix block, both with the same row count.