csv

Import with:

import csv

csv.read(path)

Reads a CSV file and returns a DataFrame.

let df = csv.read("data/experiment.csv")
print(df)

The first row is interpreted as column headers. Each subsequent row must contain exactly the same number of fields as the header.

Automatic value parsing

CSV fields are converted to Novum values using the following rules:

CSV textNovum value
empty textNull
NA, null, .Null
true / falseBool
valid integerInt
valid floating-point numberFloat
anything elseStr

For example:

name,age,score,active
Alice,20,91.5,true
Bob,21,,false

can be consumed as a DataFrame whose values retain their natural Novum runtime types.

Working with rows

Because DataFrames are iterable, you can process rows directly:

let young =
    csv.read("data/experiment.csv")
        .filter(|row| row["age"] < 25)
        .collect()

Return and errors

csv.read() returns a DataFrame on success and reports file/CSV parsing failures as runtime errors.