Skip to content

Function: fromCSV() ​

ts
function fromCSV(text, options?): Table;

Parse CSV text (RFC 4180) into a Table, like pandas' read_csv: the first record names the columns; columns whose non-empty fields are all numbers become numbers; empty fields are missing (null). Dates stay ISO strings, which Express reads as dates. Records shorter than the header are padded with missing values.

Parameters ​

ParameterType
textstring
optionsCSVOptions

Returns ​

Table

Example ​

ts
const table = fromCSV('city,temp\n"Paris, FR",21.5\nOslo,12\n');
table.column('temp'); // [21.5, 12]

Throws ​

For malformed quoting and for records with more fields than the header.

Released under the MIT License.