Public
Edited
Jun 1, 2022
1 fork
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
md`## Plot Specs`
Insert cell
Insert cell
Insert cell
Insert cell
md`## Data`
Insert cell
hourly_big3 = {
aq.addFunction(
"parse_ts",
(ts) => {
const date = new Date(ts);
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
const hour = date.getUTCHours();
return op.datetime(year, month, day, hour);
},
{
override: true
}
);
var raw = await aq.loadArrow(
await FileAttachment("hourly_big3_tl_20210825.arrow").url()
);
raw = raw.derive({ date: (d) => op.parse_ts(d.date) });
return raw;
}
Insert cell
daily_big3.orderby(aq.desc('date')).view(3)
Insert cell
daily_big3 = {
aq.addFunction(
"parse_ts",
(ts) => {
const date = new Date(ts);
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
const hour = date.getUTCHours();
return op.datetime(year, month, day, hour);
},
{
override: true
}
);
var raw = await aq.loadArrow(
await FileAttachment("daily_big3_20210824.arrow").url(),
{ autoType: true }
);
raw = raw.derive({ date: (d) => op.parse_ts(d.date) }, { before: "trips" });
return raw;
}
Insert cell
weather_big3.orderby(aq.desc("datetime")).view(3)
Insert cell
weather_big3 = {
const map_nuts3 = new Map([
[403, "DE300"],
[1975, "DE600"],
[3379, "DE212"]
]);
aq.addFunction("map_stations", (id) => map_nuts3.get(id), { override: true });
aq.addFunction(
"parse_ts",
(ts) => {
const date = new Date(ts);
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
const hour = date.getUTCHours();
return op.datetime(year, month, day, hour);
},
{
override: true
}
);
aq.addFunction("formatd3", d3.timeFormat("%b %d"), { override: true });

var raw = await aq.loadArrow(
await FileAttachment("weather_big3_20210824.arrow").url()
);
raw = raw
.derive(
{ nuts3: (d) => op.map_stations(d.stations_id) },
{ before: "date" }
)
.derive({ datetime: (d) => op.parse_ts(d.date) }, { before: "temp_mean" })
.derive({ date_label: (d) => op.formatd3(d.date) })
.select(aq.not("stations_id", "date"));
return raw;
}
Insert cell
Insert cell
_ = require("lodash@4.17.21")
Insert cell
import { aq, op } from '@uwdata/arquero'
Insert cell
Insert cell
vegalite = require('vega-lite@v5.1')
Insert cell
import { vl } from '@vega/vega-lite-api-v5'
Insert cell
d3 = require('d3@v6')
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more