packages

table::stats

On this page

Summaries: describe, value_counts, null_counts.

Implementations

impl Table

  • pub fn describe(self) -> Table§

    Source

    Summary statistics of the numeric columns: one row each for count (non-null), null_count, mean, std, min, 25%, 50%, 75%, max, under a stat column. Core's pairwise mean and two-pass variance, quantiles by linear interpolation; NaN is left out like a null.

    nabi
    let t = table::table!{ "x": [1.0, 2.0, 3.0, 4.0], "s": ["a", "b", "c", "d"] };
    let d = t.describe();
    assert(d.names() == ["stat", "x"]);
    assert(d.row(2).f64("x") == 2.5);    // mean
    assert(d.row(6).f64("x") == 2.5);    // median
    
  • pub fn value_counts(self, name: str) throws (TableError) -> Table§

    Source

    Each distinct value of column name with how many rows hold it, most common first (ties in order of first appearance); null is a value too.

    nabi
    let t = table::table!{ "c": ["x", "y", "x", none] };
    let v = try t.value_counts("c") catch _ { t };
    assert(v.names() == ["c", "count"]);
    assert(v.row(0).str("c") == "x" && v.row(0).i64("count") == 2);
    
  • pub fn null_counts(self) -> Table§

    Source

    Nulls per column, as a table of column and null_count.

  • pub fn dtypes(self) -> List<DType>§

    Source

    The type of every column, in order.