Published
Edited
Dec 14, 2021
1 fork
Importers
44 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Join temperature data onto our data to analyze its effect
data = aq
.from(demand)
.join(aq.from(temperature_with_features))
.rename({ air_temp: "temp", value: "demand" })
.select(aq.not("id", "name"))
.objects()

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
// Storing the labels separately
labels = ({
hour: new Map(_.range(24).map((d) => [d, d + ":00"])),
day: new Map(weekdays.map((d, i) => [i, d])),
month: new Map(months.map((d, i) => [i, d])),
quarter: new Map([
[0, "Q1: Jan - Mar"],
[1, "Q2: Apr - Jun"],
[2, "Q3: Jul - Sep"],
[3, "Q4: Oct - Dec "]
]),
weekend: new Map([
[0, "Weekday"],
[1, "Weekend"]
]),
week: new Map(_.range(54).map((d) => [d, d])),
daytime: new Map([
[0, "Work hours"],
[1, "Evening"],
[2, "Night"]
]),
feel: new Map([
[0, "cold"],
[1, "moderate"],
[2, "hot"]
])
})
Insert cell
// Load the Temporal API using a Polyfill
Temporal = {
const TemporalLib = await require("@js-temporal/polyfill@0.2.0");
return TemporalLib.Temporal;
}
Insert cell
Insert cell
Insert cell
import {months, weekdays} from "@observablehq/discovering-date-patterns"
Insert cell
import {Legend, Swatches} from "@d3/color-legend"
Insert cell
import {authorship, altauthorship, navigation, workshop} from "@observablehq/timeseries-assets"
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
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