Published
Edited
Dec 23, 2021
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
getEntity = async (i) =>
(
await (
await fetch(`https://www.wikidata.org/wiki/Special:EntityData/Q${i}.json`)
).json()
).entities[`Q${i}`].labels.en.value
Insert cell
// cached as entities.csv file attachment
async function* fetchEntities() {
const arr = [];
for (let i = 1; i <= 50; i++) {
try {
const name = await getEntity(i);
arr.push({ i, name });
} catch (e) {
console.error(e);
}
yield arr;
}
}
Insert cell
wd = FileAttachment("entities.csv").csv({typed: true})
Insert cell
pg = FileAttachment("pg_catalog.csv").csv({typed: true})
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