Public
Edited
Jan 26, 2023
Insert cell
Insert cell
datan = FileAttachment("data2.txt").text()
Insert cell
data = JSON.parse(datan)
Insert cell
electionYears = d3
.nest()
.key((d) => d.years)
.entries(data)
.map((d) => d.key)
.sort(d3.ascending)
Insert cell
d3 = require("d3@6")
Insert cell
test = d3.groups(data, d => d.years)
// .sort(d3.ascending)
Insert cell
test2 = [...new Set (data.map(d => d.years))];
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