Published
Edited
Mar 3, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
attachment = FileAttachment("census_white_data.csv")
Insert cell
attachment.text()
Insert cell
Insert cell
d3 = require("d3@v5")
Insert cell
fetched_data = d3.csv(
"https://gist.githubusercontent.com/palewire/780935febf3d39765cfc03c6a67627f8/raw/d9035df8319a082cfb264b9293930b06fe71c76e/census_white_data.csv"
)
Insert cell
Insert cell
text = attachment.text()
Insert cell
Insert cell
states = d3.csvParse(text, d3.autoType)
Insert cell
Insert cell
numberOfStates = states.length
Insert cell
Insert cell
firstState = states[0]
Insert cell
Insert cell
mostPopulous = states.reduce((prev, current) => {
return prev.total_pop > current.total_pop ? prev : current;
})
Insert cell
Insert cell
mostWhite = states.reduce((prev, current) => {
return prev.white_pct > current.white_pct ? prev : current;
})
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