Published
Edited
Dec 28, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
excessDeathsLatestDay.view(220)
Insert cell
offsetPendulum = {
while (true) {
yield ((Math.sin(Date.now() / 1000) + 1) / 2)
}
}
Insert cell
// + (d.name.length % 3 === 0 ? offsetPendulum * 10 : 0)
Insert cell
Insert cell
Insert cell
excessDeaths = (await FileAttachment("excess-deaths-cumulative-economist-single-entity.csv").csv()).map(d => ({name: d.Entity, code: d.Code, numericCode: isoCodeTranslationMap.get(d.Code, 0), day: d.Day, excessDeathsCentral: Number.parseFloat(d.cumulative_estimated_daily_excess_deaths), confirmedDeaths: Number.parseInt(d["Total confirmed deaths due to COVID-19"]), excessDeathsUpper: Number.parseFloat(d.cumulative_estimated_daily_excess_deaths_ci_95_top), excessDeathsLower: Number.parseFloat(d.cumulative_estimated_daily_excess_deaths_ci_95_bot) }))
Insert cell
excessDeathsTable = aq.from(excessDeaths)
Insert cell
latestDayInData = "2021-12-26"
Insert cell
excessDeathsLatestDay = excessDeathsTable.params({latestDay: latestDayInData}).filter((row, p) => row.day === p.latestDay && row.numericCode !== undefined).derive({diffOfUpperAndLower: d => d.excessDeathsUpper - d.excessDeathsLower}).orderby(aq.desc("diffOfUpperAndLower"))
Insert cell
excessDeathsLatestDay.array("excessDeathsUpper")
Insert cell
maxValue = aq.agg(excessDeathsLatestDay, op.max("excessDeathsUpper"))
Insert cell
minValue = aq.agg(excessDeathsLatestDay, op.min("excessDeathsLower"))
Insert cell
Insert cell
worldRaw = FileAttachment("countries-50m.json").json()
Insert cell
world = ({...worldRaw, objects: {...worldRaw.objects, countries: {...worldRaw.objects.countries, geometries: worldRaw.objects.countries.geometries.map(row => ({...row, id: Number.parseInt(row.id)}))}}})
Insert cell
countries = topojson.feature(world, world.objects.countries)
Insert cell
Insert cell
countrymesh = topojson.mesh(world, world.objects.countries, (a, b) => a !== b)
Insert cell
import {Choropleth} from "@d3/choropleth"
Insert cell
import {Legend} from "@d3/color-legend"
Insert cell
import { aq, op } from '@uwdata/arquero'
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