Published unlisted
Edited
Feb 18, 2022
Insert cell
Insert cell
Insert cell
courses = FileAttachment("metadata_courses.csv").csv()
Insert cell
Inputs.table(courses)
Insert cell
Insert cell
counties = FileAttachment("county_demographics.csv").csv()
Insert cell
Inputs.table(counties)
Insert cell
Insert cell
d3.groups(counties, d=>d.State)
Insert cell
Insert cell
counties.columns
Insert cell
Insert cell
d3.rollup(counties, v => d3.mean(v, e => e['Population.2020 Population']), d => d.State)
Insert cell
Insert cell
Insert cell
prereqs = FileAttachment("courses_prereqs.csv").csv()
Insert cell
Inputs.table(prereqs)
Insert cell
prereqs_text = prereqs.map(d => {
let i = d.i, j = d.j
return courses[i].name.concat(' -> ').concat(courses[j].name)
})
Insert cell
d3.group(prereqs, d => d.i)
Insert cell
d3.rollup(prereqs, v => v.length, d => d.i)
Insert cell
Insert cell
quakes = FileAttachment("earthquakes.json").json()
Insert cell
Inputs.table(quakes)
Insert cell
Inputs.table(quakes.map(d => d.impact))
Insert cell
Inputs.table(quakes.map(d => d.location))
Insert cell
Insert cell
d3.rollup(quakes, v=> d3.mean(v.map(e => e.impact.magnitude)), d => d.time.month)
Insert cell
Insert cell
wards = FileAttachment("DCwards.geojson").json()
Insert cell
Inputs.table(wards.features)
Insert cell
Inputs.table(wards.features.map(d=>d.properties))
Insert cell
Inputs.table(wards.features.map(d=>d.geometry))
Insert cell
d3 = require('d3@v7')
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
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