Public
Edited
Jan 7
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
editors = fetch(
`https://xtools.wmcloud.org/api/page/top_editors/${wiki.replace(
".org",
""
)}/${encodeURIComponent(page)}///${n}`
)
.then((d) => d.json())
.then((d) => d.top_editors)
Insert cell
doit = async function (username) {
return fetch(
`https://xtools.wmcloud.org/api/page/articleinfo/${wiki.replace(
".org",
""
)}/User:` + encodeURIComponent(username),
{ "Api-User-Agent": "PAC2" }
)
.then((d) => d.json())
.then((d) => d.page);
}
Insert cell
array = await Promise.all(
editors.map(async (d) => {
const user = await doit(d.username);
return { user, count: d.count };
})
)
Insert cell
df = aq.from(
array.map((d) => {
const prefix = d.user.split(":")[0];
return { prefix, user: d.user, count: d.count };
})
)
Insert cell
df_aggregated = df
.groupby("prefix")
.rollup({ count: op.count(), edits: (d) => op.sum(d.count) })
.orderby(aq.desc("count"))
.derive({
share_count: (d) => d.count / op.sum(d.count),
share_edits: (d) => d.edits / op.sum(d.edits)
})
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell
defaults = {
const params = new URL(document.URL).searchParams;
const parameters = {
wiki: "es.wikipedia.org",
page: "Francia",
n: "100"
};
if (params.has("wiki")) {
parameters.wiki = params.get("wiki");
}
if (params.has("page")) {
parameters.page = params.get("page");
}
if (params.has("n")) {
parameters.n = params.get("n");
}
return parameters;
}
Insert cell
defaults.wiki
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