Public
Edited
Nov 24, 2022
1 star
Insert cell
Insert cell
data = Array.from({ length: 200 }, (_, i) => ({
index: i,
blah: `a${(i * i) % 7}`,
value: i === 0 ? NaN : Math.random() * 10
}))
Insert cell
Insert cell
data
SELECT blah, SUM(ROUND(value)) -- errors because the value[0] is NaN
FROM data
GROUP BY blah
Insert cell
data
SELECT blah, SUM(ROUND(value)) FROM data
WHERE value != 'NaN' -- fix
GROUP BY blah
Insert cell
data
SELECT blah, SUM(ROUND(COALESCE(value, 0))) -- no luck with COALESCE
FROM data
GROUP BY blah
Insert cell
data
SELECT 'NaN'::float -- yup, that's the value
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