Standard plugin ยท import "csv"

CSV

Read delimited text into typed tables, control how values are interpreted, and write table results back to disk.

csv::read

csv::read(path: String, nulls: String = "", delimiter: String = ",", has_header: Bool = true, schema: String = "") -> DataFrame

With default arguments, the first row supplies column names and Ibex infers integer, floating-point, and string/categorical columns. The optional arguments let a script describe common variations without preprocessing the file.

ArgumentDefaultPurpose
pathrequiredLocal path to the CSV file.
nulls""Comma-separated tokens to interpret as null. Use <empty> to treat empty fields as null too.
delimiter","Single field delimiter, for example ";" for semicolon-separated files. Quoted fields are parsed with CSV quoting rules.
has_headertrueWhen false, generate column names col1, col2, and so on.
schema""Optional comma-separated column types: name:type by name, or a bare type by position. Types are int, double, str, cat, date and decimal(p,s). Declared columns skip inference; when every column is declared, the file binds lazily (below).

Common read configurations

Null tokens

Preserve empty cells by default; explicitly opt into empty-as-null if the source uses blank fields for missing data.

let data = csv::read("train.csv", "<empty>,NA");

Every column declared: lazy

With a type for every column, let reads only the header and the row count. Each query parses just the columns it uses and caches them. A value that does not fit its type is reported when a query first reads that column, and the file must not change while bound.

let x = csv::read("big.csv", schema = "k:cat,v:int,w:double");
x[select { s = sum(v) }, by k];  // parses k and v

Headerless, known schema

Skip type inference when the input layout is fixed. Headerless columns are named from col1.

let data = csv::read("measurements.txt", "", ";", false, "cat,f64");
import "csv";

let trades = csv::read("data/trades.csv");
trades[filter qty > 0, select { symbol, qty, price }];

csv::write

csv::write(df: DataFrame, path: String) -> Int writes a header followed by the rows of df. It returns the number of rows written.

let summary = trades[select { total = sum(qty) }, by symbol];
let rows_written = csv::write(summary, "out/summary.csv");

For a complete CSV-to-Parquet batch job and further options, see the I/O guide.