Skip to content

csv

fn read #

fn read[T](path string, config CsvReadConfig) !&vtl.Tensor[T]

read parses a numeric CSV file into a rank-two tensor. Quoted fields and quoted newlines follow the V standard library CSV reader's behavior.

fn write #

fn write[T](path string, tensor &vtl.Tensor[T], config CsvWriteConfig) !

write serializes a rank-two tensor to CSV, optionally adding a header row.

struct CsvReadConfig #

struct CsvReadConfig {
pub:
	delimiter      u8 = `,`
	comment        u8 = `#`
	skip_header    bool
	skip_rows      int
	use_cols       []int
	max_rows       int = -1
	missing_values []string
	fill_value     string
}

CsvReadConfig controls numeric CSV tensor loading.

struct CsvWriteConfig #

struct CsvWriteConfig {
pub:
	delimiter u8 = `,`
	header    []string
	use_crlf  bool
}

CsvWriteConfig controls CSV serialization of rank-two tensors.