Published
Edited
Jan 7, 2021
1 star
Insert cell
Insert cell
Insert cell
raw = d3.csv(url)
Insert cell
raw.columns
Insert cell
raw[0]
Insert cell
Insert cell
csv = d3.csv(url, (d, idx, columns) => {
let row = {};

for (const column of columns) {
if (column) {
row[column] = d[column];
}
}

return row;
})
Insert cell
Insert cell
// boo, extra spaces still
csv.columns
Insert cell
Insert cell
csv[0]
Insert cell
Insert cell
cached = {
let validColumns;

const csv = await d3.csv(url, (d, idx, columns) => {
if (!validColumns) validColumns = columns.filter(Boolean);
let row = {};

for (const column of validColumns) {
row[column] = d[column];
}

return row;
});

csv.columns = validColumns;

return csv;
}
Insert cell
cached.columns
Insert cell
Insert cell
url = FileAttachment("aapl.csv").url()
Insert cell
d3 = require('d3-fetch@2')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more