Public
Edited
Oct 17, 2023
Insert cell
Insert cell
data_file = FileAttachment("NGOs & Digital Rights in the Global South - NGOs.csv")
Insert cell
data_text = data_file.text()
Insert cell
d3 = require("d3-dsv@1")
Insert cell
data = d3.csvParse(data_text, d3.autoType)
Insert cell
import {printTable} from "@uwdata/data-utilities"
Insert cell
printTable(data)
Insert cell
// Returns an array of values in key, assuming that
// they are separated by newline characters.
function extract(i, key)
{
var values = null;
var values_text = data[i][key];
if (values_text == null)
values = [];
else
values = values_text.split("\n");

var clean_values = [];
for (var i in values)
{
var v = values[i].trim();
if (v == "")
continue;

if (v.endsWith("."))
v = v.substring(0, v.length-1);
clean_values.push(v);
}
return clean_values;
}
Insert cell
{
let ngo_nf_data = {};
let i = 0;
for (i=0;i<data.length;i++)
{
var ngo = data[i]["Name of NGO"];
var nf = extract(i, "Normalised funders");
ngo_nf_data[ngo] = nf;
}
return ngo_nf_data;
}
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