Published
Edited
Oct 18, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
joined = [...hpccDataflow.pipe(year,
hpccDataflow.map((y, i) =>({date:y, value:amount[i]}))
)];
Insert cell
Insert cell
Insert cell
min = hpccDataflow.min(r=>r.value);
Insert cell
max = hpccDataflow.max(r=>r.value);
Insert cell
mean = hpccDataflow.mean(r=>r.value);
Insert cell
Insert cell
p1 = hpccDataflow.pipe(
hpccDataflow.map((y, i) => ({date:y, value:amount[i]})),
hpccDataflow.map((r, i) => ({...r, value_int: parseInt(r.value.split(",").join(""))})),
hpccDataflow.filter((r, i) => !isNaN(r.value_int)),
hpccDataflow.map((r, i) => ({date: r.date, value: r.value_int})),
hpccDataflow.sensor(min),
hpccDataflow.sensor(max),
hpccDataflow.sensor(mean)
)
Insert cell
Insert cell
{
return {
data: [...p1(year)],
min: min.peek(),
max: max.peek(),
mean: mean.peek()
};
}
Insert cell
Insert cell
mean2 = hpccDataflow.mean(r=>r.value);
Insert cell
p2 = hpccDataflow.pipe(
p1,
hpccDataflow.sort((l, r) => l.date.localeCompare(r.date)), // Just in case
hpccDataflow.sensor(mean2)
);
Insert cell
{
const retVal = [];
for (const row of p2(year)) {
retVal.push({...row, mean: mean2.peek()});
}
return retVal;
}
Insert cell
Insert cell
[...hpccDataflow.pipe(year,
p2,
hpccDataflow.map(r => ({...r, mean: mean2.peek()}))
)];

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