Public
Edited
Oct 27, 2024
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
wardsAll = ["", "BETHNAL GREEN", "BLACKWALL & CUBITT TOWN", "BOW EAST", "BOW WEST", "BROMLEY NORTH", "BROMLEY SOUTH", "CANARY WHARF", "ISLAND GARDENS", "LANSBURY", "LIMEHOUSE", "MILE END", "POPLAR", "SHADWELL", "SPITALFIELDS & BANGLATOWN", "ST DUNSTAN'S", "ST. KATHARINE'S & WAPPING", "ST PETER'S", "STEPNEY GREEN", "WEAVERS", "WHITECHAPEL"]
Insert cell
collisions = FileAttachment("TH-LTN-collision@3.csv").csv({typed: true})
Insert cell
d3.sum(collisions.filter(d => d.Period === "pre LTN"), d => d["number_of_casualties"])
Insert cell
// collisions_mean = d3.sum(collisions.filter(d => d.Period === "pre LTN"), d => d["number_of_casualties"])
collisions_mean = {
const end = d3.max(collisions.filter(d => d.Period === "pre LTN"), d => d["utcTime"])
const start = d3.min(collisions.filter(d => d.Period === "pre LTN"), d => d["utcTime"])
const nb_year = (end - start) / (365 * 24 * 60 * 60 * 1000)
return d3.sum(collisions.filter(d => d.Period === "pre LTN"), d => d["number_of_casualties"] / nb_year)
}
Insert cell
preLTN = new Date('2020-06-01') // Assumed date LTNs installed
Insert cell
Insert cell
// responseTimesMinusE2 = responseTimes.filter(d => d.Postcode_district !== "E2")
Insert cell
collisions
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
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