Published unlisted
Edited
Dec 18, 2020
Insert cell
Insert cell
Insert cell
Insert cell
// Load the protests.csv data (a File Attachment) into a variable called `protests`
protests = FileAttachment("protests.csv").csv()
Insert cell
Insert cell
// How many protests are in the dataset? `num_protests`
num_protests = protests.length
Insert cell
Insert cell
// How much information is available about each protest? `num_features`
num_features = Object.keys(protests[0]).length
Insert cell
Insert cell
Insert cell
// Create an array of the number of attendees in each protest: `num_attendees`
// (make sure to return a *number* for each element in the array)
num_attendees = protests.map(d => +d.Attendees)
Insert cell
Insert cell
// What is the lowest number of attendees? `min_attendees`
min_attendees = d3.min(num_attendees)
Insert cell
Insert cell
// What is the highest number of attendees? `max_attendees`
max_attendees = d3.max(num_attendees)
Insert cell
Insert cell
// What is the mean number of attendees? `mean_attendees`
mean_attendees = undefined
Insert cell
Insert cell
Insert cell
import { check_answer } with { answers } from "@uw-info474/utilities"
Insert cell
d3 = require("d3")
Insert cell
_ = require("lodash")
Insert cell
answers = FileAttachment("answers@1.json").json()
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