Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
groups = chunkBy(df.array("page_title"), 20)
Insert cell
docs = {
let opts = { lang: lang, "Api-User-Agent": "wtf_wikipedia example" };

const doit = function (group) {
return wtf.fetch(group, opts); //returns a promise
};
//only allow three requests at a time
return slow.three(groups, doit).then((responses) => {
//flatten the results
return [].concat.apply([], responses);
});
}
Insert cell
cats = {
return docs.map((doc) => {
let categories = null;
if (doc.categories) {
categories = doc.categories();
}
return categories;
});
}
Insert cell
allcats = [].concat.apply([], cats)
Insert cell
dfc = aq.from(_.countBy(allcats)).orderby(aq.desc("value"))
Insert cell
wtf = require('wtf_wikipedia')
Insert cell
slow = require("slow")
Insert cell
chunkBy = function(arr, chunkSize) {
var groups = [], i;
for (i = 0; i < arr.length; i += chunkSize) {
groups.push(arr.slice(i, i + chunkSize));
}
return groups;
}

Insert cell
wtf.version
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell
get_default = () => {
const params = new URL(document.URL).searchParams;
const defaults = {
username: "PAC2",
wikipedia: "en.wikipedia.org"
};
if (params.has("username")) {
defaults.username = params.get("username");
}
if (params.has("wikipedia")) {
defaults.wikipedia = params.get("wikipedia");
}

return defaults;
}
Insert cell
import { wikipedias } from "@pac02/user-level-gender-statistics-for-wikipedia"
Insert cell
import { get_pagescreated } from "@pac02/look-at-your-list-of-created-articles-with-the-xtools-page-ap"
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
lang = wikipedia.replace(".wikipedia.org", "")
Insert cell
import { BubbleChart } from "@d3/bubble-chart"
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