Published
Edited
Jan 25, 2022
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
isBadCereal(data[1]) // should be true
Insert cell
isBadCereal(data[3]) // should be false
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
data
Insert cell
viewof aq_data = aq.from(data).view(5)
Insert cell
Insert cell
aq_data.filter(currentElement => currentElement.type === 'H').view()
Insert cell
Insert cell
aq_data.filter(currentElement => currentElement.type === 'H').objects()
Insert cell
Insert cell
aq_data.filter(d => favoriteBrands.has(d.mfr)).objects()
Insert cell
aq_data.filter(aq.escape(d => favoriteBrands.has(d.mfr))).objects()
Insert cell
Insert cell
aq_data.array('sodium')
Insert cell
Insert cell
viewof aq_cleaned = aq_data
.derive({type: currentElement => currentElement.type === "H" ? "hot" : "cold",
brand: aq.escape(currentElement => abbreviationToBrandName[currentElement.mfr])})
.select('name', 'rating', 'type', 'shelf', 'brand')
.view({height:150})
Insert cell
Insert cell
Insert cell
aq_cleaned
.filter(d => d.brand === 'Kelloggs')
.orderby('rating')
.slice(0,3)
.array('name')
Insert cell
aq_cleaned.view(5)
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof aq_pop = aq.from(state_population).view({height:150})
Insert cell
Insert cell
viewof aq_cases = aq.from(cases)
.derive({report_date: d => op.parse_date(d.report_date)})
.derive({total_cases: d => op.parse_float(d.total_cases)})
.derive({hospitalizations: d => op.parse_float(d.hospitalizations)})
.derive({deaths: d => op.parse_float(d.deaths)})
.view({height:150})
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
visualizeTicks(d3.scaleLinear().domain([0, 10]))
Insert cell
visualizeTicks(d3.scaleLinear().domain([32, 212]))
Insert cell
visualizeTicks(d3.scaleLinear().domain([32, 212]).nice())
Insert cell
import {x, y, scores} from "@nyuvis/d3-introduction"
Insert cell
Insert cell
// scores.map(d => write answer here)
Insert cell
Insert cell
Insert cell
// scores.map(d => write answer here)
Insert cell
Insert cell
Insert cell
// write answer here
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3@7")
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