Public
Edited
Oct 26, 2023
1 fork
11 stars
Insert cell
Insert cell
flights = [
{airline: "Icelandair", price: 1621, stops: 3},
{airline: "Multiple airlines", price: undefined, stops: 2},
{airline: "Air France", price: 1948, stops: 0},
{airline: "WestJet", price: undefined, stops: 1},
{airline: "Air France", price: 1951, stops: 1},
{airline: "French Bee", price: 1780, stops: 1}
]
Insert cell
Insert cell
d3.count(flights, d => d.price)
Insert cell
Insert cell
d3.mean(flights, d => d.price)
Insert cell
d3.sum(flights, d => d.price) / d3.count(flights, d => d.price)
Insert cell
Insert cell
d3.count([1, 2, undefined, 3, NaN, 4])
Insert cell
Insert cell
d3.count(["I", "accidentally", undefined, "a", "word"])
Insert cell
d3.count([new Date("2019-01-01"), new Date(NaN)])
Insert cell
Insert cell
d3.count([1, 2, 3, "N/A"]) // 🌶
Insert cell
d3.count(["1", "2", "3", "N/A"], d => +d) // 👍
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