Published
Edited
Feb 24, 2021
Insert cell
md`# Assignment 1`
Insert cell
d3 = require("d3@5")
Insert cell
topojson = require("topojson-client@3")
Insert cell
ia_counties = FileAttachment("census_2010_county_DP1.json").json()
Insert cell
ia_counties_features = topojson.feature(ia_counties, ia_counties.objects.census_2010_county_DP1)
Insert cell
csv_data = d3.csvParse(await FileAttachment("census_2010_county_DP1.csv").text(),({GEOID10, NAMELSAD10, ALAND10, AWATER10, DP0010001}) => [GEOID10, NAMELSAD10, ALAND10, AWATER10, DP0010001, ALAND10 / DP0010001])
Insert cell
// END OF ASSIGNMENT 1
Insert cell
//this is how to take the values of a variable (column) from all variables you created from the csv file
//femalepct = Array.from(csv_data.values(), d => d[1][1])
//femalepct
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: ["Females", "Female Pct"]})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more