Public
Edited
Feb 19
Insert cell
md`# Black and African American Populations in Minnesota`
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
topojson = require("topojson-client@3")
Insert cell
state= FileAttachment("MN_2020_Project.json").json()
Insert cell
state_features = topojson.feature(state, state.objects.MN_2020_Project_ExportFeatures)
Insert cell
csv_data = d3.csvParse(await FileAttachment("nhgis0004_ds248_2020_tract.csv").text(),({GISJOIN, U7B001, U7B004}) => [GISJOIN, [+U7B001, +100*U7B004/+U7B001]])
Insert cell
//this is how to take the values of a variable (column) from all variables you created from the csv file
BlackPopulationPct = Array.from(csv_data.values(), d => d[1][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: ["Black Population", "Black Population Pct"]})
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