Public
Edited
Jun 26, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
inflation_gt.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
function rebase(data, base) {
let regions = d3.group(data, (d) => d.region);

regions.forEach((value, key, map) => {
let baseInflation = value.find(
(entry) => entry.date.getTime() === base.getTime()
).inflation;

value.map((entry) => {
entry.inflationDef = (100 * entry.inflation) / baseInflation;
return entry;
});
});

let rebasedData = Array.from(regions.values()).flat();

return rebasedData;
}
Insert cell
Insert cell
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