Table of Contents

About

d3-dsv is a library to parse a DSV string (not file) into an array of rows where the property are the headers. To parse a CSV file, see D3 - CSV.

Each value from the CSV is stored as a string, even the numbers

Example

A template string containing the CSV data is passed to the d3.csvParse function.

s = `id,value
1,First
2,Second`;

var dataArray = d3.csvParse(s, function(d) {
        return {
            id: d.id, 
            value: d.value,
            i2d: d.id*2 // 2 * id transformation
        };
});
console.table(dataArray);