Published
Edited
Feb 11, 2021
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
topojson = require("topojson-client@3")
Insert cell
IowaCovidCounties = FileAttachment("ia_covid19_county.json").json()
Insert cell
CovidCounties_features = topojson.feature(IowaCovidCounties, IowaCovidCounties.objects.ia_covid19_county)
Insert cell
csv_data = d3.csvParse(await FileAttachment("ia_covid19_county.csv").text(),({FIPS, Confirmed, pop_est_20}) => [FIPS, +Confirmed/+pop_est_20])
Insert cell
//this is how to take the values of a variable (column) from all variables you created from the csv file
CasesConfirmedpct = Array.from(csv_data.values(), d => d[1])
Insert cell
//this is how you map the id column to the values. We will use this for joining with topojson later.
data = Object.assign(new Map(csv_data), {title: "Percent of Population with Confirmed Cases"})
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