packages

table::schema

On this page

Column types and the schema of a table.

Structs

FieldSource

pub struct Field

A column's name and type.

SchemaSource

pub struct Schema

The names and types of a table's columns, in order.

nabi
let t = table::table!{ "id": [1, 2], "score": [0.5, 1.5] };
let s = t.schema();
assert(s.len() == 2);
assert(s.dtype("score") == table::DType::F64);
  • pub fields: List<Field>§

    Source
  • pub fn new(fields: List<(str, DType)>) -> Schema§

    Source

    From (name, type) pairs.

  • pub fn len(self) -> usize§

    Source

    The number of columns.

  • pub fn names(self) -> List<str>§

    Source

    The column names, in order.

  • pub fn dtype(self, name: str) -> DType | none§

    Source

    The type of column name, none when there is no such column.

Trait implementations 1
  • impl Display for Schema

Enums

DTypeSource

pub enum DType

The type of a column.

nabi
assert(f"{table::DType::F64}" == "f64");
assert(table::DType::I64.is_numeric());
Trait implementations 1
  • impl Display for DType