Skip to content

Instantly share code, notes, and snippets.

@alebusi
Created May 6, 2015 13:37
Show Gist options
  • Save alebusi/dea84684cfdbeb6f59c0 to your computer and use it in GitHub Desktop.
Save alebusi/dea84684cfdbeb6f59c0 to your computer and use it in GitHub Desktop.
Final exercise, about youth unemployment.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
body {
background-color: white;
font-family: Verdana;
}
svg {
background-color: white;
}
text {
fill: black;
}
.line {
fill: none;
stroke: grey;
stroke-width: 2;
opacity: 0.1;
}
.line:hover {
stroke-width: 3;
stroke: black;
opacity: 1;
}
.axis path,
.axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
.axis text {
font-family: sans-serif;
font-size: 11px;
}
g.highlight_eu path {
stroke: steelblue;
stroke-width: 3;
opacity: 1;
}
g.highlight_me path {
stroke: green;
stroke-width: 3;
opacity: 1;
}
g.highlight_la path {
stroke: indianred;
stroke-width: 3;
opacity: 1;
}
g.highlight_ss path {
stroke: purple;
stroke-width: 3;
opacity: 1;
}
g.highlight_na path {
stroke: orange;
stroke-width: 3;
opacity: 1;
}
g.highlight_ea path {
stroke: red;
stroke-width: 3;
opacity: 1;
}
.highlight_eu {
fill: steelblue;
text-anchor: end;
font-weight: bold;
}
.highlight_me {
fill: green;
text-anchor: end;
font-weight: bold;
}
.highlight_la {
fill: indianred;
text-anchor: end;
font-weight: bold;
}
.highlight_ss {
fill: purple;
text-anchor: end;
font-weight: bold;
}
.highlight_na {
fill: orange;
text-anchor: end;
font-weight: bold;
}
.highlight_ea {
fill: red;
text-anchor: end;
font-weight: bold;
}
</style>
</head>
<body>
<h2>Youth unemployment rate across the world</h2>
<p>This dataset shows the evolution of youth unemployment over the course of two decades. It would be interesting to further explore the subject and research the reasons behind ups and downs.</p>
<script type="text/javascript">
var w = 900
var h = 500
var padding = [ 50, 50, 50, 50 ]; //Top, right, bottom, left
//Set up date formatting and years
var dateFormat = d3.time.format("%Y");
var xScale = d3.time.scale()
.range ([ padding[1], w - padding[3] ]);
var yScale = d3.scale.linear()
.range ([ padding[0], h - padding[2] ]);
var xAxis = d3.svg.axis()
.scale(xScale)
.orient("bottom")
.ticks(30);
var yAxis = d3.svg.axis()
.scale(yScale)
.orient("left")
.ticks(15);
//Configure line generator
var line = d3.svg.line()
.x(function(d) {
return xScale(dateFormat.parse(d.year));
})
.y(function(d) {
return yScale(+d.amount);
});
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
d3.csv("sl.uem.1524.zs_Indicator_en_excel_v2.csv", function(data) {
//Data is loaded in, but we need to restructure it.
//Remember, each line requires an array of x/y pairs;
//that is, an array of arrays, like so:
//
// [ [x: 1, y: 1], [x: 2, y: 2], [x: 3, y: 3] ]
//
//We, however, are using 'year' as x and 'amount' as y.
//We also need to know which country belongs to each
//line, so we will build an array of objects that is
//structured like this:
/*
[
{
country: "Australia",
emissions: [
{ year: 1961, amount: 90589.568 },
{ year: 1962, amount: 94912.961 },
{ year: 1963, amount: 101029.517 },
]
},
{
country: "Bermuda",
percentage: [
{ year: 1961, amount: 176.016 },
{ year: 1962, amount: 157.681 },
{ year: 1963, amount: 150.347 },
]
},
]
*/
//Note that this is an array of objects. Each object
//contains two values, 'country' and 'emissions'.
//The 'emissions' value is itself an array, containing
//more objects, each one holding 'year' and 'amount' values.
//New array with all the years, for referencing later
var years = ["1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013"];
//Create a new, empty array to hold our restructured dataset
var dataset = [];
//Loop once for each row in data
for (var i = 0; i < data.length; i++) {
//Create new object with this country's name and empty array
dataset[i] = {
country: data[i].countryName,
percentage: []
};
//Loop through all the years
for (var j = 0; j < years.length; j++) {
// If value is not empty
if (data[i][years[j]]) {
//Add a new object to the percentage data array
//for this country
dataset[i].percentage.push({
year: years[j],
amount: data[i][years[j]]
});
}
}
}
console.log(dataset);
//Uncomment to log the original data to the console
// console.log(data);
//Uncomment to log the newly restructured dataset to the console
// console.log(dataset);
xScale.domain([
d3.min(years, function(d) {
return dateFormat.parse(d);
}),
d3.max(years, function(d) {
return dateFormat.parse(d);
})
]);
yScale.domain([
d3.max(dataset, function(d) {
return d3.max(d.percentage, function(d) {
return +d.amount;
});
}),
0
]);
var groups = svg.selectAll("g")
.data(dataset)
.enter()
.append("g")
.classed("highlight_eu", function(d) {
if (d.country == "European Union") {
return true;
} else {
return false;
}
})
.classed("highlight_me", function(d) {
if (d.country == "Middle East & North Africa (all income levels)") {
return true;
} else {
return false;
}
})
.classed("highlight_la", function(d) {
if (d.country == "Latin America & Caribbean (all income levels)") {
return true;
} else {
return false;
}
})
.classed("highlight_ss", function(d) {
if (d.country == "Sub-Saharan Africa (all income levels)") {
return true;
} else {
return false;
}
})
.classed("highlight_na", function(d) {
if (d.country == "North America") {
return true;
} else {
return false;
}
})
.classed("highlight_ea", function(d) {
if (d.country == "East Asia & Pacific (all income levels)") {
return true;
} else {
return false;
}
});
// var labels = groups.selectAll("text")
// .data(data)
// .enter()
// .append("text");
//Append a title with the country name (so we get easy tooltips)
groups.append("title")
.text(function(d) {
return d.country;
});
//Within each group, create a new line/path,
//binding just the emissions data to each one
groups.selectAll("path")
.data(function(d) {
return [ d.percentage ];
})
.enter()
.append("path")
.attr("class", "line")
.attr("d", line);
//Make lines get to the front on mouseover
d3.selectAll("path")
.on("mouseover", function(d) {
d3.select(this)
this.parentNode.parentNode.appendChild(this.parentNode);
})
.on("mouseout", function(d) {
d3.select(this)
});
svg.append("text")
.attr("class", "highlight_eu")
.attr("x", w - padding[1])
.attr("y", padding[0] + 15)
.attr("font-size", 10)
.text("Europe");
svg.append("text")
.attr("class", "highlight_me")
.attr("x", w - padding[1])
.attr("y", padding[0] + 30)
.attr("font-size", 10)
.text("North Africa and Middle East");
svg.append("text")
.attr("class", "highlight_la")
.attr("x", w - padding[1])
.attr("y", padding[0] + 45)
.attr("font-size", 10)
.text("South America");
svg.append("text")
.attr("class", "highlight_ss")
.attr("x", w - padding[1])
.attr("y", padding[0] + 60)
.attr("font-size", 10)
.text("Sub-Saharan Africa");
svg.append("text")
.attr("class", "highlight_na")
.attr("x", w - padding[1])
.attr("y", padding[0] + 75)
.attr("font-size", 10)
.text("North America");
svg.append("text")
.attr("class", "highlight_ea")
.attr("x", w - padding[1])
.attr("y", padding[0] + 90)
.attr("font-size", 10)
.text("East Asia and Pacific");
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + (h - padding[0]) + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.attr("transform", "translate(" + (padding[3]) + ", 0)")
.call(yAxis);
});
</script>
</body>
</html>
countryName 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013
Aruba
Andorra
Afghanistan 8 8 8 8 8 8 8 8 8 8 8 8 8 8 20 20 20 20 20 20 20 20 18
Angola 11 11 12 11 10 10 11 11 11 11 11 10 11 11 10 10 10 10 11 11 11 11 11
Albania 21 26 33 32 30 28 27 29 30 25 36 24 21 21 21 21 22 27 25 26 27 28 29
Arab World 28 28 29 29 29 28 27 27 26 29 29 29 30 30 28 27 26 25 25 25 28 29 29
United Arab Emirates 8 8 9 6 6 7 6 9 9 6 9 9 7 8 8 8 8 11 10 10 10 10 10
Argentina 12 13 21 21 33 31 25 23 24 26 30 34 36 28 24 25 20 19 21 20 19 18 20
Armenia 40 38 41 37 48 38 37 36 34 36 48 54 56 50 56 55 58 36 40 38 39 35 33
American Samoa
Antigua and Barbuda
Australia 18 19 19 17 15 16 16 15 13 12 14 13 12 11 11 10 9 9 12 11 11 12 12
Austria 4 4 5 5 5 6 6 6 5 5 6 6 7 10 10 9 9 8 10 9 8 9 9
Azerbaijan 12 18 19 17 15 11 15 24 11 28 26 24 22 19 18 16 13 14 14 15 15 14 15
Burundi 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Belgium 14 13 19 22 22 21 21 20 22 15 16 18 22 21 22 20 19 18 22 23 19 20 23
Benin 1 2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2
Burkina Faso 4 4 5 4 4 4 4 4 4 5 4 5 5 4 4 4 5 5 5 5 5 5 5
Bangladesh 8 9 8 8 7 6 8 6 9 9 9 9 6 7 9 9 9 9 11 8 8 9 9
Bulgaria 35 28 43 41 32 28 28 25 30 33 39 36 27 24 22 19 15 13 16 23 25 28 30
Bahrain 25 25 25 24 25 25 23 22 23 21 19 21 23 27 27 27 27 27 27 27 27 28 28
Bahamas, The 23 27 24 24 21 24 22 15 16 15 15 19 24 23 20 16 19 18 36 36 27 30 29
Bosnia and Herzegovina 48 49 54 56 51 52 58 54 52 51 56 50 53 60 53 63 59 48 49 57 57 62 60
Belarus 13 13 13 12 13 13 13 14 14 14 14 15 14 14 13 13 13 12 13 13 12 12 12
Belize 19 19 18 21 24 25 24 25 22 19 16 18 18 19 19 17 15 15 21 21 24 30 30
Bermuda
Bolivia 6 9 9 9 9 9 8 6 8 9 9 9 9 8 10 10 10 6 6 6 6 5 5
Brazil 14 12 11 11 11 13 14 17 18 18 18 18 19 18 19 18 17 16 18 17 15 14 14
Barbados 33 42 44 42 38 28 30 25 22 20 23 24 26 22 21 20 17 19 23 25 26 26 27
Brunei Darussalam 13 11 10 10 11 12 10 10 12 11 11 11 12 10 10 10 10 10 11 11 11 12 12
Bhutan 5 6 6 7 7 7 5 4 4 5 5 5 5 7 6 8 11 11 13 8 8 6 7
Botswana 15 37 38 40 39 36 30 14 41 40 39 22 40 39 37 30 32 37 34 33 33 33 34
Central African Republic 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 13
Canada 16 17 17 16 15 15 16 15 14 13 13 14 14 14 12 12 11 12 15 15 14 14 14
Central Europe and the Baltics 23 22 25 26 24 23 21 20 24 27 30 31 30 30 28 24 19 17 22 25 25 26 27
Switzerland 3 5 7 6 6 5 6 6 6 5 6 6 9 8 9 8 7 7 9 8 8 9 9
Channel Islands
Chile 18 18 19 19 17 15 15 15 22 22 21 22 21 21 20 18 18 20 23 19 18 16 16
China 9 8 8 8 9 9 9 10 10 9 9 9 9 9 9 8 8 9 9 9 9 10 10
Cote d'Ivoire 8 9 8 7 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
Cameroon 10 10 10 10 6 15 14 14 13 11 14 10 10 8 8 7 7 8 9 7 7 7 7
Congo, Rep. 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Colombia 23 19 22 23 23 23 22 25 28 31 26 27 25 27 24 23 23 23 24 24 23 21 21
Comoros 11 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Cabo Verde 11 11 11 11 11 11 11 11 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Costa Rica 12 8 9 9 12 12 12 12 13 11 14 14 15 14 15 14 11 11 18 17 17 19 18
Caribbean small states 30 30 31 29 32 31 30 30 30 29 28 26 23 25 23 20 19 20 23 25 24 26 28
Cuba 5 8 7 7 16 15 15 13 13 11 9 7 5 4 4 4 4 4 4 5 7 7 7
Curacao
Cayman Islands
Cyprus 20 5 20 8 8 8 7 10 13 10 8 7 8 8 13 9 10 8 13 16 21 27 37
Czech Republic 5 7 8 9 8 7 9 13 17 17 16 16 18 20 19 18 11 10 17 19 18 20 19
Germany 6 6 8 8 8 9 10 9 9 8 8 10 11 13 15 14 12 10 11 10 8 8 8
Djibouti
Dominica
Denmark 12 12 15 10 10 11 8 7 10 7 8 7 9 8 9 8 8 8 12 14 14 14 13
Dominican Republic 35 38 38 30 29 30 29 27 26 23 23 21 32 35 34 31 30 28 30 25 30 30 30
Algeria 40 44 44 42 48 48 44 44 44 51 47 45 43 41 31 24 28 24 22 22 23 26 24
East Asia & Pacific (developing only) 10 8 9 9 9 9 10 11 11 11 11 12 11 12 12 11 10 11 11 11 11 11 11
East Asia & Pacific (all income levels) 10 8 9 9 9 9 10 11 11 11 11 12 11 12 11 11 10 11 11 11 11 11 11
Europe & Central Asia (developing only) 19 19 21 19 18 18 19 20 20 19 20 21 21 21 20 20 19 19 21 21 20 20 21
Europe & Central Asia (all income levels) 19 18 20 21 20 21 21 21 21 20 19 19 20 20 19 18 17 17 20 21 20 21 22
Ecuador 9 12 12 11 12 12 12 13 14 16 18 18 20 15 15 14 11 14 14 11 11 10 10
Egypt, Arab Rep. 30 26 32 32 33 26 25 24 21 26 29 28 29 30 34 31 26 26 27 26 36 38 39
Euro area 18 19 23 25 24 25 24 22 21 19 17 18 18 19 19 17 16 17 21 22 23 26 27
Eritrea 11 11 10 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Spain 30 33 42 44 42 42 39 35 29 26 21 23 23 23 20 19 19 25 39 43 47 54 57
Estonia 3 7 12 14 14 16 19 15 22 24 25 17 24 24 16 12 10 12 28 33 23 21 18
Ethiopia 10 10 9 10 12 12 12 12 12 11 11 10 9 8 8 8 8 8 8 8 8 8 8
European Union 19 19 23 24 23 23 22 21 21 20 19 20 20 20 20 19 16 16 21 22 23 25 26
Fragile and conflict affected situations 16 17 16 16 16 16 16 16 16 16 16 16 17 17 17 17 17 17 17 17 18 18 18
Finland 15 25 31 31 27 25 23 22 20 20 19 20 20 20 19 18 16 16 20 20 19 18 20
Fiji 13 12 13 12 12 13 15 18 18 17 14 13 19 11 11 15 20 21 21 20 20 20 19
France 19 21 25 28 27 27 29 26 26 21 18 19 18 20 21 21 19 18 23 23 22 24 24
Faeroe Islands
Micronesia, Fed. Sts.
Gabon 37 39 42 41 39 38 37 37 37 37 37 37 37 37 37 37 37 36 36 35 35 36 35
United Kingdom 14 16 18 17 16 15 14 13 12 12 11 11 12 11 13 14 15 15 19 20 20 21 20
Georgia 28 28 28 27 29 27 27 27 24 21 20 28 24 28 28 29 31 36 39 37 37 34 31
Ghana 15 15 15 15 15 15 15 15 16 16 16 16 15 16 7 7 7 10 9 8 7 8 9
Guinea 2 2 2 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2
Gambia, The 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Guinea-Bissau 11 11 11 11 11 11 11 12 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Equatorial Guinea 11 10 11 10 10 9 7 10 10 10 9 10 10 10 11 11 10 10 11 11 11 11 13
Greece 24 24 28 26 26 29 29 29 31 29 27 26 26 26 25 25 23 22 26 32 44 55 58
Grenada
Greenland
Guatemala 5 5 4 4 6 6 6 5 3 2 2 5 5 5 4 3 4 5 5 6 7 5 5
Guam
Guyana 25 27 27 27 27 26 26 26 25 25 25 24 25 24 26 23 23 24 24 23 23 24 24
High income 16 15 16 17 17 17 17 17 17 16 15 16 16 16 15 15 14 14 18 18 18 18 18
Hong Kong SAR, China 4 4 5 4 7 7 5 11 14 11 12 15 15 12 11 10 9 9 13 12 9 9 9
Honduras 8 5 5 5 5 7 5 7 7 7 7 6 8 10 7 5 5 5 6 8 8 8 8
Heavily indebted poor countries (HIPC) 11 12 11 11 11 12 11 11 11 11 11 11 11 10 10 11 10 11 11 11 11 11 11
Croatia 40 26 25 25 25 26 25 30 34 39 46 36 36 33 32 29 24 22 26 34 37 44 52
Haiti 25 26 26 27 24 25 25 25 17 18 18 18 18 18 18 17 17 18 17 19 17 17 17
Hungary 27 19 23 21 19 18 16 14 13 13 11 12 14 15 19 19 18 20 26 27 26 28 27
Indonesia 18 8 14 16 13 14 15 18 18 18 23 26 26 29 33 31 26 24 23 25 21 20 22
Isle of Man
India 11 11 11 8 9 9 10 11 10 10 11 10 9 9 10 10 9 10 10 10 10 11 11
Not classified
Ireland 23 23 25 23 19 18 16 12 9 6 6 8 8 8 9 9 9 13 24 28 29 30 27
Iran, Islamic Rep. 22 24 23 23 22 22 23 23 22 26 24 25 24 20 24 23 22 23 24 28 28 29 30
Iraq 38 38 38 38 38 38 36 38 37 37 38 38 53 53 38 37 36 33 33 33 33 33 34
Iceland 5 10 10 12 11 8 8 6 4 5 5 7 8 8 7 8 7 8 16 16 15 13 11
Israel 23 23 21 17 15 14 15 17 17 17 18 21 22 21 18 18 16 13 15 14 12 12 11
Italy 28 28 30 32 33 35 34 34 33 31 28 27 27 25 24 22 20 21 26 28 29 35 40
Jamaica 31 28 31 28 36 36 35 36 36 34 36 32 23 29 26 23 22 26 27 30 30 33 36
Jordan 31 36 41 39 31 29 28 29 28 28 34 35 34 27 33 30 29 29 29 30 32 31 34
Japan 5 4 5 6 6 7 7 8 9 9 10 10 10 10 9 8 8 7 9 9 8 8 7
Kazakhstan 16 13 13 9 13 15 15 15 15 15 12 17 14 14 9 9 8 7 7 6 5 5 5
Kenya 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17
Kyrgyz Republic 16 16 16 15 16 16 15 17 15 14 14 20 17 15 14 15 15 15 17 17 16 17 16
Cambodia 1 1 2 4 4 4 5 5 5 6 4 5 5 4 3 2 1 1 0 1 1 1 1
Kiribati
St. Kitts and Nevis
Korea, Rep. 7 7 9 7 6 6 7 16 14 11 10 9 10 11 10 10 9 9 10 10 10 9 9
Kosovo
Kuwait 6 5 5 4 4 4 4 4 4 5 5 7 8 10 12 8 9 11 9 11 22 21 20
Latin America & Caribbean (developing only) 13 12 12 12 15 15 14 15 15 16 16 17 17 17 16 15 14 13 15 15 14 14 13
Lao PDR 5 5 6 6 6 4 5 5 4 4 4 4 5 6 3 3 3 3 3 3 3 3 3
Lebanon 21 21 21 20 21 21 18 21 22 22 21 21 22 21 21 22 23 20 21 21 21 20 21
Liberia 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
Libya 42 42 43 43 43 43 43 44 44 44 44 44 44 44 44 44 44 44 44 44 43 53 51
St. Lucia
Latin America & Caribbean (all income levels) 13 12 13 13 15 15 14 15 16 16 16 17 17 17 16 15 14 14 16 15 14 14 13
Least developed countries: UN classification 11 11 11 11 11 10 11 10 10 11 11 10 10 10 10 11 11 11 11 11 11 11 11
Low income 9 10 9 9 9 9 10 9 10 10 10 9 9 9 9 10 9 10 10 9 10 10 10
Liechtenstein
Sri Lanka 42 41 36 36 35 33 32 26 27 24 25 28 26 27 26 21 21 18 21 19 17 17 18
Lower middle income 13 12 13 12 12 12 12 13 13 13 14 14 14 14 14 14 13 13 13 13 13 14 14
Low & middle income 12 12 12 12 12 12 12 13 13 13 14 14 14 13 13 13 12 13 13 13 13 13 13
Lesotho 42 45 47 45 40 35 48 41 34 45 45 41 47 44 45 40 34 34 35 34 36 32 33
Lithuania 30 17 25 32 32 29 26 25 25 29 32 20 27 21 16 10 8 13 29 35 32 26 22
Luxembourg 3 4 5 8 7 9 7 7 7 6 6 7 11 17 14 16 15 18 17 15 17 19 19
Latvia 23 22 22 27 22 22 26 27 24 21 23 26 18 19 14 12 11 13 34 35 31 28 20
Macao SAR, China 6 4 4 6 6 7 8 10 11 10 11 11 13 11 8 7 6 6 8 5 6 5 4
Morocco 18 17 17 17 16 16 16 15 20 20 19 18 17 15 16 17 17 18 18 18 18 19 19
Monaco
Moldova 15 15 14 14 14 14 18 12 26 16 17 15 18 20 19 17 14 11 15 18 15 13 15
Madagascar 4 5 4 6 4 4 3 3 2 2 5 6 7 5 2 5 5 6 6 6 6 6 5
Maldives 21 21 22 23 23 23 23 23 24 24 24 24 23 24 23 22 25 24 25 25 25 25 27
Middle East & North Africa (all income levels) 27 27 28 28 28 27 26 26 25 28 28 29 29 28 28 26 25 25 25 26 29 30 30
Mexico 5 5 5 7 11 9 7 6 4 5 5 6 6 8 7 6 7 7 10 9 10 10 9
Marshall Islands
Middle income 13 12 13 12 12 13 13 14 14 14 15 15 14 14 14 14 13 13 13 14 14 14 14
Macedonia, FYR 53 52 50 55 54 61 61 72 63 60 56 59 66 65 63 60 58 57 55 54 55 54 52
Mali 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 10 10 11 11
Malta 14 14 14 14 17 14 14 12 16 12 18 15 17 18 17 16 14 12 14 13 14 14 14
Myanmar 10 10 10 10 10 10 10 10 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10
Middle East & North Africa (developing only) 28 28 29 29 29 28 27 27 26 29 29 30 30 28 28 26 25 25 25 26 30 31 31
Montenegro 33 34 38 42 35 36 42 41 42 36 42 42 42 35 36 33 39 31 36 46 37 41 41
Mongolia 10 10 10 11 14 11 12 12 11 11 11 12 11 11 13 10 12 10 10 14 9 10 9
Northern Mariana Islands
Mozambique 14 15 14 14 15 14 14 14 14 15 14 14 14 14 14 14 14 14 14 14 14 14 14
Mauritania 43 44 44 44 44 44 44 44 44 44 44 44 45 45 44 44 43 43 43 43 43 43 43
Mauritius 22 22 22 22 23 21 20 21 23 20 17 19 21 25 26 23 24 19 21 23 22 24 24
Malawi 13 14 13 14 13 13 13 14 14 14 14 14 13 13 14 14 13 13 13 13 14 14 14
Malaysia 9 10 12 11 9 7 7 9 10 9 11 11 11 11 11 10 11 11 12 11 10 10 11
North America 14 15 14 13 13 13 12 11 11 10 11 12 13 12 12 11 11 13 18 18 17 16 16
Namibia 35 35 35 32 33 35 37 38 40 44 43 36 42 42 39 43 37 60 52 44 40 34 34
New Caledonia
Niger 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
Nigeria 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
Nicaragua 5 5 5 4 4 4 4 7 5 4 4 5 13 11 9 9 8 10 10 12 12 12 10
Netherlands 11 8 10 11 12 11 10 9 7 5 4 5 7 8 8 7 6 5 7 9 8 10 11
High income: nonOECD 23 15 16 18 20 20 23 26 23 21 19 18 19 19 17 19 16 16 20 19 18 18 18
Norway 13 14 14 12 12 12 10 9 9 10 10 11 12 12 12 9 7 8 9 9 9 9 9
Nepal 3 3 3 4 4 7 6 5 3 4 6 5 4 4 4 4 4 5 5 5 5 5 5
New Zealand 19 19 18 16 12 12 14 15 14 14 12 12 11 10 10 10 10 12 16 17 17 18 16
High income: OECD 14 15 16 16 16 16 16 15 15 14 14 15 15 15 15 14 13 14 17 18 18 18 18
OECD members 13 14 15 15 15 15 14 14 14 13 13 14 15 15 14 13 13 13 17 17 17 17 17
Oman 21 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 22 22 21 21 21 20 21
Other small states 25 28 29 28 27 26 28 25 28 29 29 25 29 29 28 27 26 29 28 27 26 25 25
Pakistan 10 9 7 8 9 9 10 10 11 13 14 14 13 12 11 9 8 8 8 8 8 8 9
Panama 31 29 27 27 27 30 27 29 25 29 30 28 28 25 21 20 16 14 15 15 12 10 10
Peru 13 10 11 11 11 12 11 10 11 12 11 13 12 12 11 10 10 10 9 9 10 9 9
Philippines 17 17 17 17 16 14 15 19 20 23 21 24 22 23 17 18 18 17 17 17 16 16 17
Palau
Papua New Guinea 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5
Poland 25 27 30 32 31 28 24 23 29 35 40 43 42 41 37 29 22 17 21 23 26 26 27
Puerto Rico 35 35 31 28 27 29 28 26 24 21 23 24 24 21 24 23 23 25 29 31 30 27 27
Korea, Dem. Rep. 6 6 6 6 6 10 10 11 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Portugal 9 10 13 15 16 17 15 10 9 9 9 12 15 15 16 16 17 17 20 22 30 38 38
Paraguay 12 10 13 12 6 8 10 10 12 14 14 19 15 14 11 13 12 12 13 12 10 11 11
Pacific island small states
French Polynesia
Qatar 2 1 1 1 1 1 2 1 2 4 4 4 5 6 4 3 2 1 1 1 2 1 2
Romania 21 23 23 23 21 21 18 17 17 18 18 22 20 22 20 22 20 19 21 22 24 23 24
Russian Federation 24 13 14 16 19 19 23 27 24 21 18 16 18 17 15 17 15 14 18 17 15 15 15
Rwanda 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
South Asia 11 11 10 8 9 9 10 10 10 10 11 10 9 9 10 10 9 10 10 10 10 10 10
Saudi Arabia 26 26 28 26 29 27 30 30 23 24 24 27 29 29 29 35 30 30 30 30 30 28 29
Sudan 23 23 23 23 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 25
Senegal 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 15 15 15
Singapore 9 6 6 7 7 7 7 12 13 13 13 17 19 16 15 13 11 12 16 11 11 10 10
Solomon Islands 10 9 10 9 9 10 10 10 10 11 11 10 10 9 9 10 10 9 10 9 9 10 10
Sierra Leone 5 5 5 5 5 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
El Salvador 11 14 17 13 14 14 14 13 13 13 13 11 11 11 13 12 11 11 13 13 12 12 12
San Marino
Somalia 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Serbia 28 31 41 44 30 29 31 30 30 28 29 31 34 42 47 47 43 34 42 46 50 51 49
Sub-Saharan Africa (developing only) 15 15 15 15 14 15 15 15 15 15 15 15 15 14 14 14 14 14 14 14 14 14 14
South Sudan
Sub-Saharan Africa (all income levels) 15 15 15 15 14 15 15 15 15 15 15 15 15 14 14 14 14 14 14 14 14 14 14
Small states 25 27 28 28 28 27 27 26 28 28 28 25 27 27 26 25 24 27 26 26 25 25 25
Sao Tome and Principe
Suriname 25 42 35 30 28 29 28 28 34 39 24 24 29 36 24 26 23 22 25 21 20 21 23
Slovak Republic 20 21 23 27 25 21 23 25 34 37 39 37 33 33 30 27 20 19 28 34 33 34 34
Slovenia 13 11 32 22 19 17 17 18 19 16 16 17 18 16 16 14 10 11 14 15 16 21 23
Sweden 8 14 23 23 20 22 22 17 15 12 12 13 14 17 23 22 20 21 25 25 23 24 24
Swaziland 43 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42
Sint Maarten (Dutch part)
Seychelles
Syrian Arab Republic 19 19 14 14 14 18 17 14 15 19 23 28 19 19 19 18 19 22 16 19 34 32 30
Turks and Caicos Islands
Chad 11 11 11 11 11 11 11 11 11 11 11 11 10 10 11 11 11 11 11 10 11 11 11
Togo 11 11 12 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
Thailand 7 4 4 3 3 3 2 8 8 7 8 6 5 5 5 5 5 5 6 4 3 3 3
Tajikistan 17 17 17 16 17 17 18 19 19 18 18 20 19 19 18 18 17 16 17 17 16 16 16
Turkmenistan 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 20
Timor-Leste 16 16 16 15 15 15 16 17 16 16 21 20 19 18 17 16 17 16 15 13 13 13 13
Tonga
Trinidad and Tobago 34 34 33 32 31 29 27 27 25 23 21 21 21 17 16 13 11 10 12 14 10 11 13
Tunisia 31 31 31 31 32 32 32 36 33 33 32 33 31 30 31 28 28 28 31 29 43 32 31
Turkey 15 16 18 16 15 13 14 14 15 13 16 19 20 20 19 18 19 20 25 21 18 17 20
Tuvalu
Tanzania 7 7 7 7 8 9 8 9 8 9 9 7 7 6 5 8 3 4 5 6 7 7 7
Uganda 5 5 5 6 5 4 5 5 5 5 4 6 6 4 3 6 5 6 7 7 7 7 7
Ukraine 15 16 18 15 12 16 19 24 25 25 23 21 20 16 15 15 14 14 18 17 19 17 18
Upper middle income 13 12 12 12 13 13 13 14 14 15 15 15 15 15 14 13 13 13 14 14 14 14 14
Uruguay 20 21 21 21 25 21 19 20 28 26 24 23 21 20 24 28 25 19 19 21 18 19 19
United States 14 15 14 13 12 12 12 11 10 10 11 12 13 12 12 11 11 13 18 19 17 17 16
Uzbekistan 20 20 20 20 20 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 20
St. Vincent and the Grenadines
Venezuela, RB 18 14 13 16 20 25 20 21 26 24 23 28 28 26 20 17 14 14 15 18 17 17 16
Virgin Islands (U.S.)
Vietnam 5 5 6 5 4 3 5 4 5 5 6 4 5 4 5 5 5 5 6 6 5 5 5
Vanuatu
West Bank and Gaza 22 38 38 35 24 35 30 21 17 21 35 42 41 40 39 36 35 40 38 38 34 39 38
World 13 12 13 13 13 13 13 14 14 14 14 14 14 14 14 13 12 13 14 14 14 14 14
Samoa
Yemen, Rep. 26 24 21 26 25 23 25 27 24 28 24 24 24 24 27 27 26 25 25 30 30 30 30
South Africa 48 46 49 40 34 42 46 44 46 45 50 53 55 51 48 47 47 46 48 51 50 52 54
Congo, Dem. Rep. 16 16 16 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14
Zambia 32 32 33 32 31 26 24 20 21 22 25 25 25 24 24 26 26 25 26 26 26 25 25
Zimbabwe 13 13 14 12 13 14 16 15 14 14 8 8 7 7 8 9 10 11 13 10 8 9 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment