Public
Edited
Nov 28, 2024
2 forks
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.csvParse(await FileAttachment("debt.csv").text(), d3.autoType)
Insert cell
names = Array.from(new Set(data.flatMap(d => [d.source, d.target])))
Insert cell
matrix = {
const index = new Map(names.map((name, i) => [name, i]))
const matrix = Array.from(index, () => new Array(names.length).fill(0))
for (const {source, target, value} of data) matrix[index.get(source)][index.get(target)] += value
return matrix
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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