Skip to content

Instantly share code, notes, and snippets.

@asifsalam
Last active August 29, 2015 14:18
Show Gist options
  • Save asifsalam/13ec6002c776f5e87843 to your computer and use it in GitHub Desktop.
Save asifsalam/13ec6002c776f5e87843 to your computer and use it in GitHub Desktop.
Ranking the 36 countries that spend on aid (2010, MUSD, AidData.org)
Country_Name Country_ISO3 Country_ISO2 Year GDP_MUSD GDP_pCapita_KUSD Aid_MUSD Milit_Exp_MUSD Milit_pCapita_USD
Afghanistan AFG AF 2010 15936.78 0.56 0 576 20.28
Albania ALB AL 2010 11926.96 4.18 0 190 60.31
Algeria DZA DZ 2010 161207.3 4.35 0 5671 153.01
Angola AGO AO 2010 82470.89 4.22 0 3501 179.09
Antigua and Barbuda ATG AG 2010 1135.54 13.02 0 NA NA
Argentina ARG AR 2010 462703.79 11.46 0 3476 86.09
Armenia ARM AM 2010 9260.29 3.12 0 395 133.29
Aruba ABW AW 2010 2467.7 24.29 0 NA NA
Australia AUS AU 2010 1141267.76 51.8 4355.15 23221 1052.38
Austria AUT AT 2010 389656.07 46.44 713.84 3219 383.68
Azerbaijan AZE AZ 2010 52902.7 5.84 0 1476 163.02
Bahamas The BHS BS 2010 7910 21.94 0 NA NA
Bahrain BHR BH 2010 25713.54 20.55 0 776 620.05
Bangladesh BGD BD 2010 115279.08 0.76 0 1413 9.35
Barbados BRB BB 2010 4433.7 15.81 0 NA NA
Belarus BLR BY 2010 55220.93 5.82 0 768 80.93
Belgium BEL BE 2010 484404.27 44.36 2247.29 5245 481.39
Belize BLZ BZ 2010 1397.11 4.53 0 15.3 49.58
Benin BEN BJ 2010 6561.78 0.69 0 NA 0
Bermuda BMU BM 2010 5744.41 88.21 0 NA NA
Bhutan BTN BT 2010 1585.4 2.21 0 NA NA
Bolivia BOL BO 2010 19649.63 1.93 0 328 32.29
Bosnia and Herzegovina BIH BA 2010 16847.49 4.38 0 220 57.2
Botswana BWA BW 2010 13746.71 6.98 0 349 177.22
Brazil BRA BR 2010 2143067.87 10.98 160.35 34007 174.21
Brunei Darussalam BRN BN 2010 12369.71 30.88 0 391 976.11
Bulgaria BGR BG 2010 48669.06 6.58 0 894 118.66
Burkina Faso BFA BF 2010 9209.29 0.59 0 124 7.98
Burundi BDI BI 2010 2026.86 0.22 0 NA 0
Cabo Verde CPV CV 2010 1664.31 3.41 0 8.3 17.02
Cambodia KHM KH 2010 11242.27 0.78 0 178 12.39
Cameroon CMR CM 2010 23622.48 1.15 0 354 17.16
Canada CAN CA 2010 1614072.09 47.47 4199.05 19319 566.1
Chad TCD TD 2010 10657.71 0.91 0 226 19.28
Chile CHL CL 2010 217501.91 12.68 3.43 4707 274.45
China CHN CN 2010 5930502.27 4.43 0 123338 92.2
Colombia COL CO 2010 287018.18 6.18 10.34 10422 224.4
Comoros COM KM 2010 516.96 0.76 0 NA NA
Congo Dem. Rep. ZAR CD 2010 21561.94 0.35 0 184 2.96
Congo Rep. COG CG 2010 12007.88 2.92 0 134 32.59
Costa Rica CRI CR 2010 36298.33 7.77 0 0 0
Cote d Ivoire CIV CI 2010 24884.5 1.31 0 388 20.45
Croatia HRV HR 2010 59643.82 13.5 0 1016 229.98
Cuba CUB CU 2010 64328.22 5.7 0 94.3 8.36
Cyprus CYP CY 2010 23132.45 27.89 3.97 478 433.09
Czech Republic CZE CZ 2010 207016.4 19.76 0 2498 237.46
Denmark DNK DK 2010 319812.41 57.65 1827.56 4504 811.87
Djibouti DJI DJ 2010 1128.61 1.35 0 NA 0
Dominica DMA DM 2010 492.96 6.93 0 NA NA
Dominican Republic DOM DO 2010 53042.94 5.3 0 355 35.95
Ecuador ECU EC 2010 69555.37 4.64 0 2094 139.59
Egypt EGY EG 2010 218887.81 2.8 0 4289 54.93
El Salvador SLV SV 2010 21418.3 3.44 0 226 36.34
Equatorial Guinea GNQ GQ 2010 11582.92 16.64 0 NA 0
Eritrea ERI ER 2010 2117.04 0.37 0 NA 0
Estonia EST EE 2010 19479.01 14.63 2.92 332 247.73
Ethiopia ETH ET 2010 29933.79 0.34 0 304 3.49
Fiji FJI FJ 2010 3140.51 3.65 0 50.5 58.68
Finland FIN FI 2010 247799.82 46.2 1168.26 3400 633.93
France FRA FR 2010 2646837.11 40.71 11195.4 61785 950.08
Gabon GAB GA 2010 14569.53 9.36 0 125 80.32
Gambia The GMB GM 2010 951.83 0.57 0 NA 0
Georgia GEO GE 2010 11638.54 2.61 0 454 101.96
Germany DEU DE 2010 3412008.77 41.72 11884.76 46258 565.66
Ghana GHA GH 2010 32174.84 1.33 0 125 5.15
Greece GRC GR 2010 299598.06 26.86 224.82 8164 722
Grenada GRD GD 2010 771.02 7.37 0 NA NA
Guatemala GTM GT 2010 41337.96 2.88 0 170 11.85
Guinea GIN GN 2010 4735.96 0.44 0 NA 0
Guinea-Bissau GNB GW 2010 847.49 0.53 0 17.1 10.78
Guyana GUY GY 2010 2259.29 2.87 0 28.8 36.64
Haiti HTI HT 2010 6622.54 0.67 0 0 0
Honduras HND HN 2010 15839.34 2.08 0 170 22.31
Hong Kong HKG HK 2010 228637.7 32.55 0 NA NA
Hungary HUN HU 2010 129585.6 12.96 0 1351 135.1
Iceland ISL IS 2010 13261.04 41.7 0 19.9 62.57
India IND IN 2010 1708458.88 1.42 642.59 46090 38.23
Indonesia IDN ID 2010 709190.82 2.95 0 4663 19.37
Iran IRN IR 2010 422567.97 5.67 0 9478 127.29
Iraq IRQ IQ 2010 138516.72 4.47 0 3581 115.66
Ireland IRL IE 2010 218435.25 47.9 617.29 1274 284.73
Israel ISR IL 2010 232908 30.55 0 14773 1937.8
Italy ITA IT 2010 2126620.4 35.88 1039.64 36034 595.77
Jamaica JAM JM 2010 13230.84 4.92 0 116 42.94
Japan JPN JP 2010 5495387.18 43.12 18850.03 53796 422.09
Jordan JOR JO 2010 26425.38 4.37 0 1367 226.1
Kazakhstan KAZ KZ 2010 148047.35 9.07 0 1502 92.02
Kenya KEN KE 2010 40000.14 0.98 0 622 15.2
Kiribati KIR KI 2010 150.43 1.54 0 NA NA
South Korea KOR KR 2010 1094499.35 22.15 1921.19 27572 558.02
Kosovo KSV XK 2010 5830.32 3.28 0 NA NA
Kuwait KWT KW 2010 115428.56 38.58 325.79 4329 1447.06
Kyrgyz Republic KGZ KG 2010 4794.36 0.88 0 184 33.77
Lao PDR LAO LA 2010 7181.44 1.12 0 16.3 2.55
Latvia LVA LV 2010 24009.68 11.45 0.02 260 116.12
Lebanon LBN LB 2010 38009.95 8.76 0 1585 365.12
Lesotho LSO LS 2010 2175.69 1.08 0 70.7 35.19
Liberia LBR LR 2010 1292.7 0.33 0 8.5 2.15
Libya LBY LY 2010 74755.29 12.38 0 NA 0
Lithuania LTU LT 2010 36709.51 11.85 0 326 99.18
Luxembourg LUX LU 2010 52143.65 102.86 343.82 331 652.92
Macao MAC MO 2010 28359.71 53.05 0 NA NA
Macedonia MKD MK 2010 9338.67 4.44 0 130 61.84
Madagascar MDG MG 2010 8729.94 0.41 0 56.9 2.7
Malawi MWI MW 2010 5398.62 0.36 0 NA 0
Malaysia MYS MY 2010 247533.53 8.75 0 3854 136.3
Maldives MDV MV 2010 2134.1 6.55 0 NA NA
Mali MLI ML 2010 9422.27 0.67 0 147 10.51
Malta MLT MT 2010 8163.84 19.7 0 58.7 141.11
Marshall Islands MHL MH 2010 163.92 3.13 0 NA NA
Mauritania MRT MR 2010 3526.95 0.98 0 NA 0
Mauritius MUS MU 2010 9718.23 7.59 0 14.9 11.63
Mexico MEX MX 2010 1051627.95 8.92 0 5897 50.02
Micronesia FSM FM 2010 294.12 2.84 0 NA NA
Moldova MDA MD 2010 5811.6 1.63 0 18.3 5.14
Monaco MCO MC 2010 5350.99 145.23 0 NA NA
Mongolia MNG MN 2010 6200.36 2.29 0 54.9 20.24
Montenegro MNE ME 2010 4114.88 6.64 0 75.1 121.11
Morocco MAR MA 2010 90770.67 2.82 0 3161 99.9
Mozambique MOZ MZ 2010 10165.35 0.42 0 82.5 3.44
Namibia NAM NA 2010 11282 5.18 0 397 182.2
Nepal NPL NP 2010 15994.09 0.6 0 255 9.5
Netherlands NLD NL 2010 836389.94 50.34 6453.17 11221 675.34
New Zealand NZL NZ 2010 143466.74 32.85 326.95 1595 365.17
Nicaragua NIC NI 2010 8938.21 1.54 0 44.3 7.61
Niger NER NE 2010 5718.59 0.36 0 47.2 2.97
Nigeria NGA NG 2010 369062.4 2.31 0 1990 12.46
Norway NOR NO 2010 420945.71 86.1 4361.09 6499 1329.24
Oman OMN OM 2010 58641.35 20.92 0 4895 1746.49
Pakistan PAK PK 2010 177165.64 1.02 0 5975 34.51
Palau PLW PW 2010 197.56 9.65 0 NA NA
Panama PAN PA 2010 28814.1 7.83 0 0 0
Papua New Guinea PNG PG 2010 9480.05 1.38 0 46.3 6.75
Paraguay PRY PY 2010 20030.53 3.1 0 216 33.44
Peru PER PE 2010 148522.81 5.08 0 1958 66.91
Philippines PHL PH 2010 199589.45 2.14 0 2438 26.09
Poland POL PL 2010 476687.89 12.48 0 8791 230.23
Portugal PRT PT 2010 238303.44 22.54 418.13 4719 443.63
Puerto Rico PRI PR 2010 98381.27 26.44 0 NA NA
Qatar QAT QA 2010 125122.25 71.51 0 1877 1072.75
Romania ROM RO 2010 164792.25 8.14 0 2086 97.3
Russian Federation RUS RU 2010 1524916.11 10.71 0 58720 412.39
Rwanda RWA RW 2010 5698.55 0.53 0 74.5 6.87
Samoa WSM WS 2010 643.06 3.46 0 NA NA
Sao Tome and Principe STP ST 2010 201.04 1.13 0 NA NA
Saudi Arabia SAU SA 2010 526811.47 19.33 692.95 45245 1659.86
Senegal SEN SN 2010 12932.43 1 0 200 15.44
Serbia SRB RS 2010 39368.63 5.4 0 872 110.21
Seychelles SYC SC 2010 973.36 10.84 0 7.2 80.2
Sierra Leone SLE SL 2010 2578.16 0.45 0 24.5 4.26
Singapore SGP SG 2010 236420.34 46.57 0 8106 1596.71
Slovak Republic SVK SK 2010 89011.92 16.51 6.74 1130 208.1
Slovenia SVN SI 2010 47972.99 23.42 21.73 772 376.85
Solomon Islands SLB SB 2010 681.59 1.29 0 NA NA
South Africa ZAF ZA 2010 365208.43 7.18 0 4188 83.77
South Sudan SSD SS 2010 15728.05 1.58 0 651 65.49
Spain ESP ES 2010 1431587.61 30.74 5056.35 14744 320.03
Sri Lanka LKA LK 2010 49567.52 2.4 0 1532 74.18
St. Kitts and Nevis KNA KN 2010 692.46 13.23 0 NA NA
St. Lucia LCA LC 2010 1244.3 7.01 0 NA NA
St. Vincent and the Grenadines VCT VC 2010 681.23 6.23 0 NA NA
Sudan SDN SD 2010 65632.08 1.44 0 NA 0
Suriname SUR SR 2010 4368.4 8.32 0 NA NA
Swaziland SWZ SZ 2010 3891.56 3.26 0 124 103.93
Sweden SWE SE 2010 488377.69 52.08 3386.02 5886 627.63
Switzerland CHE CH 2010 581208.56 74.28 2248.76 4115 525.88
Syrian Arab Republic SYR SY 2010 NA NA 0 2346 108.95
Tajikistan TJK TJ 2010 5642.18 0.74 0 NA 0
Tanzania TZA TZ 2010 22915 0.52 0 283 6.29
Thailand THA TH 2010 318907.93 4.8 5.14 4970.65 74.86
Timor-Leste TMP TL 2010 934 0.88 0 26.4 23.11
Togo TGO TG 2010 3172.95 0.5 0 56.8 9.01
Tonga TON TO 2010 369.21 3.55 0 NA NA
Trinidad and Tobago TTO TT 2010 20758.19 15.63 0 NA 0
Tunisia TUN TN 2010 44426.02 4.21 0 571 54.13
Turkey TUR TR 2010 731168.05 10.14 0 17747 246.02
Turkmenistan TKM TM 2010 22148.07 4.39 0 NA 0
Tuvalu TUV TV 2010 31.82 3.24 0 NA NA
Uganda UGA UG 2010 16031 0.47 0 609 17.92
Ukraine UKR UA 2010 136419.3 2.97 0 3710 80.88
United Arab Emirates ARE AE 2010 286049.29 33.89 1258.61 17505 2073.67
United Kingdom GBR GB 2010 2407933.77 38.36 5437.98 58099 933
United States USA US 2010 14964400 48.38 34093.08 698180 2257.1
Uruguay URY UY 2010 38881.1 11.53 0 788 233.69
Uzbekistan UZB UZ 2010 39332.77 1.38 0 NA 0
Vanuatu VUT VU 2010 700.8 2.97 0 NA NA
Venezuela VEN VE 2010 393801.56 13.56 0 3363 115.79
Vietnam VNM VN 2010 115931.75 1.33 0 2672 30.74
West Bank and Gaza WBG PS 2010 8913.1 2.34 0 NA NA
Yemen YEM YE 2010 31743.75 1.39 0 NA 0
Zambia ZMB ZM 2010 20265.4 1.53 0 276 20.88
Zimbabwe ZWE ZW 2010 9456.81 0.72 0 98.3 7.52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Aid Spending</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
<style type="text/css">
body {
background-color: #ffffff;
font-family: Helvetica, Arial, sans-serif;
padding: 50px;
}
svg {
background-color: #f7efea;
}
rect {
fill: #03cbbe;
}
</style>
</head>
<body>
<p>36 countries that spend on aid (2010, MUSD, AidData.org).</p>
<script type="text/javascript">
var svg = d3.select("body")
.append("svg")
.attr("width", 905)
.attr("height", 600);
//Load in contents of CSV file
d3.csv("ElemOfNationalPower_2010.csv", function(data) {
//Log 'data' to the console, for verification.
//console.log(data);
data.sort(function(a, b) {
return d3.descending(+a.Aid_MUSD, +b.Aid_MUSD);
});
data = data.slice(0,36);
console.log(data);
var rects = svg.selectAll("rect")
.data(data)
.enter()
.append("rect");
rects.attr("x", 105)
.attr("y", function(d, i) {
return i * 15;
})
.attr("width", function(d) {
return +d.Aid_MUSD * 800/35000 ;
})
.attr("height", 13)
.append("title")
.text(function(d) {
return d.Country_Name + "'s aid spending is " + d.Aid_MUSD + " million USD";
});
var countries = svg.selectAll("text")
.data(data)
.enter()
.append("text");
countries.attr("x", 100)
.attr("y", function(d,i) {
return i * 15 + 11; })
.attr("fill", "black")
.attr("font-size", "10px")
.attr("font-weight", "normal")
.attr("font-family", "sans-serif")
.attr("text-anchor", "end")
.text(function(d) {
return d.Country_Name});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment