Published
Edited
Feb 26, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
convertCSV = d => ({
...d,
calendar_year: parseInt(d.calendar_year),
filed_year: parseInt(d.filed_year),
incident_year: parseInt(d.incident_year),
amount_awarded: parseFloat(d.amount_awarded),
other_expenses: parseFloat(d.other_expenses),
total_incurred: parseFloat(d.total_incurred)
})
Insert cell
Insert cell
// Used this to help make the cells above, left for reference
// html`${directories.map(d => {
// const parts = d.split("_");
// const city = parts
// .slice(0, parts.length - 1)
// .map(c => journalize.capfirst(c))
// .join("");
// const citySlug = parts.slice(0, parts.length - 1).join("_");
// const state = parts[parts.length - 1].toUpperCase();
// return html`<p><code>Settlements${city}${state} = d3.csv("https://raw.githubusercontent.com/fivethirtyeight/police-settlements/main/${d}/final/${citySlug}_edited.csv")</code></p>`;
// })}`
Insert cell
Insert cell
journalize = require("journalize")
Insert cell
d3 = require("d3")
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