Published
Edited
Mar 11, 2020
Importers
Insert cell
md`# utils`
Insert cell
d3 = require('d3')
Insert cell
read_csv = async (url, { types }) => {
const res = await fetch(url);
const data = await res.text();
const parsed = d3.csvParse(data);
return !types
? parsed
: parsed.map(row => {
parsed.columns.forEach((col, i) => {
const t = types.charAt(i);
row[col] =
t === 'd' ? new Date(row[col]) : t === 'n' ? +row[col] : row[col];
});
return row;
});
}
Insert cell
md`let's test this...`
Insert cell
d = await read_csv('https://vis4.net/data/dwd/stations/00430.csv', {
types: 'dnnnnn'
})
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