Published
Edited
May 7, 2021
7 stars
Insert cell
Insert cell
data = [
{ group: 'a', name: 'n0', value: 5 },
{ group: 'a', name: 'n1', value: 10 },
{ group: 'b', name: 'n2', value: 12 },
{ group: 'c', name: 'n3', value: 35 },
{ group: 'c', name: 'n4', value: 55 }
]
Insert cell
results = tidy(
data,
groupBy('group', summarize({ total: sum('value'), items: items => items }))
)
Insert cell
Table(results)
Insert cell
JSON.stringify(results)
Insert cell
Insert cell
import { tidy, groupBy, summarize, sum } from '@pbeshai/tidyjs'
Insert cell
import { Table } from "@observablehq/inputs"
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