Published
Edited
Jun 5, 2021
Importers
Insert cell
md`# Haiyan and Barbuda Data Wrangling`
Insert cell
d3 = require('d3@5')
Insert cell
D =d3.csv('https://raw.githubusercontent.com/zavenanarsh/data/b58c2d91476500b8e5e3535b018073abfbd6c509/typhoon-yolanda-dswd-dromic-consolidated-27jan2014_pcoded.csv',d => {
return {
//+d to convert string in to int
key:d.Municipality,
province: d.Province,
values: d.displaced_people,
}
})
Insert cell
values = d3.nest()
.key(d => d.province)
.entries(D)
Insert cell
data = {
let test = {"key": "flare",values}
return test;
}

Insert cell
cities = {
let test = {"type": "FeatureCollection","features":data2}
return test;
}
Insert cell
data2wrong=[
{"type":"Feature","properties": {"Name":"Peace, love, and happiness"},geometry:{type:"Point",coordinates:[17.5905032, 61.8530129]}},
{"type":"Feature","properties": {"Name":"Codrington Lagoon area"},geometry:{type:"Point",coordinates:[17.639835, 61.824364]}},
{"type":"Feature","properties": {"Name":"New Airport"},geometry:{type:"Point",coordinates:[17.620109, 61.796664]}},
{"type":"Feature","properties": {"Name":"Princess Diana beach"},geometry:{type:"Point",coordinates:[17.5594,61.7698]}},
{"type":"Feature","properties": {"Name":"Barbuda Ocean Club"},geometry:{type:"Point",coordinates:[17.549735, 61.765611 ]}},
{"type":"Feature","properties": {"Name":"Coco Point Lodge"},geometry:{type:"Point",coordinates:[17.548313, 61.765650]}},
]
Insert cell
data2=[
{"type":"Feature","properties": {"Name":"Peace, love, and happiness"},geometry:{type:"Point",coordinates:[-61.8530129, 17.5905032]}},
{"type":"Feature","properties": {"Name":"Codrington Lagoon area"},geometry:{type:"Point",coordinates:[-61.824364, 17.639835]}},
{"type":"Feature","properties": {"Name":"New Airport"},geometry:{type:"Point",coordinates:[-61.796664, 17.620109]}},
{"type":"Feature","properties": {"Name":"Princess Diana beach"},geometry:{type:"Point",coordinates:[-61.7698,17.5594]}},
{"type":"Feature","properties": {"Name":"Barbuda Ocean Club"},geometry:{type:"Point",coordinates:[-61.765611, 17.549735 ]}},
{"type":"Feature","properties": {"Name":"Coco Point Lodge"},geometry:{type:"Point",coordinates:[-61.765650, 17.548313]}},
]
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