Public
Edited
Dec 3, 2022
1 fork
Insert cell
Insert cell
async function* fetchMedianFemaleIncome(places) {
//yield places;
// Use the Data Commons API to fetch the median female income for the specified places
const response = await fetch(`https://api.datacommons.org/statistics/medianIncome/persons/bySex/female?dcids=${places.join(
","
)}`
);
const data = await response.json();
yield data;
// Yield the place and income data
for (const [place, income] of Object.entries(data.observations)) {
yield { place, income: income.value };
}
}
Insert cell
x = {
var locs = ["Berkeley"];
var mfi = fetchMedianFemaleIncome(locs);
console.log(mfi)
}
Insert cell
xq
Insert cell
z = {
var x = await go;
yield x;
}
Insert cell
z
Insert cell
{
const elements = ["Fire", "Air", "Water"];

console.log(elements.join());
// expected output: "Fire,Air,Water"

console.log(elements.join(""));
// expected output: "FireAirWater"

console.log(elements.join("-"));
// expected output: "Fire-Air-Water"

yield elements.join("-");
}
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