Public
Edited
Feb 17
6 forks
Importers
94 stars
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
dt = aq.table({
'Seattle': [69, 108, 178, 207, 253, 268, 312, 281, 221, 142, 72, 52],
'Chicago': [135, 136, 187, 215, 281, 311, 318, 283, 226, 193, 113, 106],
'San Francisco': [165, 182, 251, 281, 314, 330, 300, 272, 267, 243, 189, 156]
});
Insert cell
Insert cell
// Arquero table expressions can use arrow function syntax.
dt.derive({
month: d => op.row_number(),
diff: d => d.Seattle - d.Chicago
})
.select('month', 'diff')
.orderby('month')
.view({ height: 400 });
Insert cell
Insert cell
// Aggregate operations accept column name strings outside a function context.
dt.rollup({
corr_sf: op.corr('Seattle', 'San Francisco'),
corr_chi: op.corr('Seattle', 'Chicago')
})
.view();
Insert cell
Insert cell
// Reshape (fold) the data to a two column layout: city, sun.
dt.fold(aq.all(), { as: ['city', 'sun'] })
.groupby('city')
.rollup({
min: d => op.min(d.sun), // functional form of op.min('sun')
max: d => op.max(d.sun),
avg: d => op.average(d.sun),
med: d => op.median(d.sun),
// functional forms permit flexible table expressions
skew: ({sun: s}) => (op.mean(s) - op.median(s)) / op.stdev(s) || 0
})
.objects()
Insert cell
Insert cell
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