Skip to main content

Crate quarb_csv

Crate quarb_csv 

Source
Expand description

CSV adapter for Quarb.

Maps tabular data onto the arbor model the way a DataFrame maps onto a table: one node per record, one property per column.

  • The unnamed root has one row child per record, in file order, so /row iterates the table, /row[5] is the fifth record, and //row @| count is the row count.
  • Columns are properties, named by the header: ::age reads the age cell. Numeric-looking cells participate in comparisons and arithmetic via the numeric reading (::price * ::qty).
  • An empty cell is a missing value: the property projects as null, which numeric aggregates skip and null propagation respects — pandas’ NaN behavior without a sentinel.
  • Rows are leaves; there are no traits and no crosslinks.
  • :::columns on the root lists the column names; :::n-rows counts records; :::n-fields on a row counts its cells; :::delimiter and :::decimal on the root say what was decided.

The first record must be the header. Parsing is strict about ragged rows (a record with the wrong field count is an error).

The delimiter is decided, never sniffed: ?delimiter= on the mount, else an Excel sep=X first line (a declaration, not a row), else the extension’s (tab for .tsv, comma otherwise). A header that never contains the decided delimiter but another candidate throughout is refused, naming the option. Numbers in cells read in the canonical form; a source that writes decimal commas declares it (?decimal=comma), and its cells with a reading under that convention arrive in canonical form.

Structs§

CsvAdapter
A Quarb adapter over a parsed CSV table.
CsvOptions
How a delimited file is read: the options a mount carries (?delimiter=, ?decimal=) and the extension’s default.

Enums§

CsvError

Functions§

delimiter_label
A delimiter by its label.