Public
Edited
Oct 17
3 forks
Importers
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = {
let result = [];
let offset = "";
while (offset !== undefined) {
let data = await get_pagescreated({
username: username,
wikipedia: wikipedia,
offset: offset
});
offset = data.continue;
result = result.concat(aq.from(Object.values(data.pages[0])));
yield result;
}
return result;
}
Insert cell
df = data[0].union(data)
Insert cell
genders = await Promise.all(
df
.objects()
.map(
(d) =>
(d.gender = get_gender(d.page_title, get_shortwikipedianame(wikipedia)))
)
)
Insert cell
results = aq.from(_.countBy(genders))
.filter(
d => op.includes(d.key, 'Q')
)
Insert cell
table_labels = aq.table(({
key: results.array("key"),
label: await Promise.all(
results.objects().map(d => get_label(d.key, "en"))
)
}))
Insert cell
df_fulltable = aq
.table({
page_title: df.array("page_title"),
timestamp: df.array("timestamp"),
key: genders
})
.filter((d) => op.includes(d.key, "Q"))
.join_left(table_labels, "key")
.derive({
year: (d) => op.parse_int(op.substring(d.timestamp, 0, 4))
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
get_gender("Timnit Gebru", "frwiki")
Insert cell
Insert cell
get_label("Q6581072", "en")
Insert cell
get_label("P31")
Insert cell
Insert cell
get_shortwikipedianame("fr.wikipedia.org")
Insert cell
Insert cell
get_default().username
Insert cell
get_default().wikipedia
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more