Project 1: Deaths by tuberculosis

produced by Jez Phipps, with earlier assistance from Michel Wermelinger, on 11th October 2016.

This is the project notebook for Week 1 of The Open University's Learn to code for Data Analysis course.

In 2000, the United Nations set eight Millenium Development Goals (MDGs) to reduce poverty and diseases, improve gender equality and environmental sustainability, etc. Each goal is quantified and time-bound, to be achieved by the end of 2015. Goal 6 is to have halted and started reversing the spread of HIV, malaria and tuberculosis (TB). TB doesn't make headlines like Ebola, SARS (severe acute respiratory syndrome) and other epidemics, but is far deadlier. For more information, see the World Health Organisation (WHO) page http://www.who.int/gho/tb/en/.

Given the population and number of deaths due to TB in some countries during one year, the following questions will be answered:

  • What is the total, maximum, minimum and average number of deaths in that year?
  • Which countries have the most and the least deaths?
  • What is the death rate (deaths per 100,000 inhabitants) for each country?
  • Which countries have the lowest and highest death rate?

The death rate allows for a better comparison of countries with widely different population sizes.

In [51]:
from IPython.display import display, HTML
HTML('''Note: <p style="display:inline;color:darkred;">Option to toggle code visibility on/off is at <a href="#Bottom">bottom</a> of page.</p>''')
Out[51]:
Note:

Option to toggle code visibility on/off is at bottom of page.

The data

The data consists of total population and total number of deaths due to TB (excluding HIV) in 2013 in each of the BRICS (Brazil, Russia, India, China, South Africa) and Portuguese-speaking countries.

The data was taken in July 2015 from http://apps.who.int/gho/data/node.main.POP107?lang=en (population) and http://apps.who.int/gho/data/node.main.593?lang=en (deaths). The uncertainty bounds of the number of deaths were ignored.

The data was collected into an Excel file which should be in the same folder as this notebook.

In [52]:
import warnings
warnings.simplefilter('ignore', FutureWarning)

def roundToInt(number):
    return int(round(number, -1)) # Round to nearest 10

from pandas import *
data = read_excel('WHO POP TB all.xls', encoding='utf-8')
numberOfRows = len(data.index) # Get number of rows
set_option('max_rows', numberOfRows) # Set max_rows option to display numberOfRows
data
Out[52]:
Country Population (1000s) TB deaths
0 Afghanistan 30552 13000.00
1 Albania 3173 20.00
2 Algeria 39208 5100.00
3 Andorra 79 0.26
4 Angola 21472 6900.00
5 Antigua and Barbuda 90 1.20
6 Argentina 41446 570.00
7 Armenia 2977 170.00
8 Australia 23343 45.00
9 Austria 8495 29.00
10 Azerbaijan 9413 360.00
11 Bahamas 377 1.80
12 Bahrain 1332 9.60
13 Bangladesh 156595 80000.00
14 Barbados 285 2.00
15 Belarus 9357 850.00
16 Belgium 11104 18.00
17 Belize 332 20.00
18 Benin 10323 1300.00
19 Bhutan 754 88.00
20 Bolivia (Plurinational State of) 10671 430.00
21 Bosnia and Herzegovina 3829 190.00
22 Botswana 2021 440.00
23 Brazil 200362 4400.00
24 Brunei Darussalam 418 13.00
25 Bulgaria 7223 150.00
26 Burkina Faso 16935 1500.00
27 Burundi 10163 2300.00
28 Côte d'Ivoire 20316 4000.00
29 Cabo Verde 499 150.00
30 Cambodia 15135 10000.00
31 Cameroon 22254 7800.00
32 Canada 35182 62.00
33 Central African Republic 4616 2200.00
34 Chad 12825 2900.00
35 Chile 17620 220.00
36 China 1393337 41000.00
37 Colombia 48321 770.00
38 Comoros 735 58.00
39 Congo 4448 2000.00
40 Cook Islands 21 0.41
41 Costa Rica 4872 33.00
42 Croatia 4290 52.00
43 Cuba 11266 37.00
44 Cyprus 1141 2.30
45 Czech Republic 10702 28.00
46 Democratic People's Republic of Korea 24895 6700.00
47 Democratic Republic of the Congo 67514 46000.00
48 Denmark 5619 24.00
49 Djibouti 873 870.00
50 Dominica 72 2.70
51 Dominican Republic 10404 590.00
52 Ecuador 15738 320.00
53 Egypt 82056 550.00
54 El Salvador 6340 61.00
55 Equatorial Guinea 757 67.00
56 Eritrea 6333 1200.00
57 Estonia 1287 32.00
58 Ethiopia 94101 30000.00
59 Fiji 881 37.00
60 Finland 5426 17.00
61 France 64291 340.00
62 Gabon 1672 910.00
63 Gambia 1849 370.00
64 Georgia 4341 310.00
65 Germany 82727 300.00
66 Ghana 25905 1100.00
67 Greece 11128 77.00
68 Grenada 106 1.10
69 Guatemala 15468 250.00
70 Guinea 11745 3200.00
71 Guinea-Bissau 1704 1200.00
72 Guyana 800 130.00
73 Haiti 10317 2700.00
74 Honduras 8098 230.00
75 Hungary 9955 81.00
76 Iceland 330 0.93
77 India 1252140 240000.00
78 Indonesia 249866 64000.00
79 Iran (Islamic Republic of) 77447 2500.00
80 Iraq 33765 780.00
81 Ireland 4627 18.00
82 Israel 7733 16.00
83 Italy 60990 310.00
84 Jamaica 2784 17.00
85 Japan 127144 2100.00
86 Jordan 7274 35.00
87 Kazakhstan 16441 1600.00
88 Kenya 44354 9100.00
89 Kiribati 102 30.00
90 Kuwait 3369 33.00
91 Kyrgyzstan 5548 620.00
92 Lao People's Democratic Republic 6770 3600.00
93 Latvia 2050 43.00
94 Lebanon 4822 42.00
95 Lesotho 2074 960.00
96 Liberia 4294 2100.00
97 Libya 6202 540.00
98 Lithuania 3017 250.00
99 Luxembourg 530 2.20
100 Madagascar 22925 12000.00
101 Malawi 16363 1500.00
102 Malaysia 29717 1700.00
103 Maldives 345 7.60
104 Mali 15302 1600.00
105 Malta 429 1.50
106 Marshall Islands 53 21.00
107 Mauritania 3890 1000.00
108 Mauritius 1244 15.00
109 Mexico 122332 2200.00
110 Micronesia (Federated States of) 104 22.00
111 Monaco 38 0.03
112 Mongolia 2839 140.00
113 Montenegro 621 1.20
114 Morocco 33008 2800.00
115 Mozambique 25834 18000.00
116 Myanmar 53259 26000.00
117 Namibia 2303 1300.00
118 Nauru 10 0.67
119 Nepal 27797 4600.00
120 Netherlands 16759 20.00
121 New Zealand 4506 6.30
122 Nicaragua 6080 160.00
123 Niger 17831 3100.00
124 Nigeria 173615 160000.00
125 Niue 1 0.01
126 Norway 5043 4.40
127 Oman 3632 25.00
128 Pakistan 182143 49000.00
129 Palau 21 0.36
130 Panama 3864 180.00
131 Papua New Guinea 7321 2400.00
132 Paraguay 6802 200.00
133 Peru 30376 2300.00
134 Philippines 98394 27000.00
135 Poland 38217 650.00
136 Portugal 10608 140.00
137 Qatar 2169 2.70
138 Republic of Korea 49263 2600.00
139 Republic of Moldova 3487 480.00
140 Romania 21699 1200.00
141 Russian Federation 142834 17000.00
142 Rwanda 11777 810.00
143 Saint Kitts and Nevis 54 1.60
144 Saint Lucia 182 2.20
145 Saint Vincent and the Grenadines 109 3.10
146 Samoa 190 6.10
147 San Marino 31 0.00
148 Sao Tome and Principe 193 18.00
149 Saudi Arabia 28829 960.00
150 Senegal 14133 2900.00
151 Serbia 9511 150.00
152 Seychelles 93 1.40
153 Sierra Leone 6092 2600.00
154 Singapore 5412 94.00
155 Slovakia 5450 35.00
156 Slovenia 2072 21.00
157 Solomon Islands 561 81.00
158 Somalia 10496 7700.00
159 South Africa 52776 25000.00
160 South Sudan 11296 4500.00
161 Spain 46927 240.00
162 Sri Lanka 21273 1300.00
163 Sudan 37964 9700.00
164 Suriname 539 12.00
165 Swaziland 1250 1100.00
166 Sweden 9571 13.00
167 Switzerland 8078 17.00
168 Syrian Arab Republic 21898 450.00
169 Tajikistan 8208 570.00
170 Thailand 67010 8100.00
171 The former Yugoslav republic of Macedonia 2107 33.00
172 Timor-Leste 1133 990.00
173 Togo 6817 810.00
174 Tonga 105 2.50
175 Trinidad and Tobago 1341 29.00
176 Tunisia 10997 230.00
177 Turkey 74933 310.00
178 Turkmenistan 5240 1300.00
179 Tuvalu 10 2.80
180 Uganda 37579 4100.00
181 Ukraine 45239 6600.00
182 United Arab Emirates 9346 64.00
183 United Kingdom of Great Britain and Northern I... 63136 340.00
184 United Republic of Tanzania 49253 6000.00
185 United States of America 320051 490.00
186 Uruguay 3407 40.00
187 Uzbekistan 28934 2200.00
188 Vanuatu 253 16.00
189 Venezuela (Bolivarian Republic of) 30405 480.00
190 Viet Nam 91680 17000.00
191 Yemen 24407 990.00
192 Zambia 14539 3600.00
193 Zimbabwe 14150 5700.00

The range of the problem

The column of interest is the last one.

In [53]:
tbColumn = data['TB deaths']

The total number of deaths in 2013 is:

In [54]:
tbColumn.sum()
Out[54]:
1072677.97

The largest and smallest number of deaths in a single country are:

In [55]:
tbColumn.max()
Out[55]:
240000.0
In [56]:
tbColumn.min()
Out[56]:
0.0

From zero to almost a quarter of a million deaths is a huge range. The average number of deaths, over all countries in the data, can give a better idea of the seriousness of the problem in each country. The average can be computed as the mean or the median. Given the wide range of deaths, the median is probably a more sensible average measure.

In [57]:
tbColumn.mean()
Out[57]:
5529.2678865979378
In [58]:
tbColumn.median()
Out[58]:
315.0

The median is far lower than the mean. This indicates that some of the countries had a very high number of TB deaths in 2013, pushing the value of the mean up.

The most affected

To see the most affected countries, the table is sorted in ascending order by the last column, which puts those countries in the last rows.

In [59]:
set_option('max_rows', numberOfRows) # Set max_rows option to display numberOfRows
data.sort('TB deaths')
Out[59]:
Country Population (1000s) TB deaths
147 San Marino 31 0.00
125 Niue 1 0.01
111 Monaco 38 0.03
3 Andorra 79 0.26
129 Palau 21 0.36
40 Cook Islands 21 0.41
118 Nauru 10 0.67
76 Iceland 330 0.93
68 Grenada 106 1.10
5 Antigua and Barbuda 90 1.20
113 Montenegro 621 1.20
152 Seychelles 93 1.40
105 Malta 429 1.50
143 Saint Kitts and Nevis 54 1.60
11 Bahamas 377 1.80
14 Barbados 285 2.00
144 Saint Lucia 182 2.20
99 Luxembourg 530 2.20
44 Cyprus 1141 2.30
174 Tonga 105 2.50
50 Dominica 72 2.70
137 Qatar 2169 2.70
179 Tuvalu 10 2.80
145 Saint Vincent and the Grenadines 109 3.10
126 Norway 5043 4.40
146 Samoa 190 6.10
121 New Zealand 4506 6.30
103 Maldives 345 7.60
12 Bahrain 1332 9.60
164 Suriname 539 12.00
166 Sweden 9571 13.00
24 Brunei Darussalam 418 13.00
108 Mauritius 1244 15.00
188 Vanuatu 253 16.00
82 Israel 7733 16.00
167 Switzerland 8078 17.00
60 Finland 5426 17.00
84 Jamaica 2784 17.00
81 Ireland 4627 18.00
16 Belgium 11104 18.00
148 Sao Tome and Principe 193 18.00
120 Netherlands 16759 20.00
1 Albania 3173 20.00
17 Belize 332 20.00
156 Slovenia 2072 21.00
106 Marshall Islands 53 21.00
110 Micronesia (Federated States of) 104 22.00
48 Denmark 5619 24.00
127 Oman 3632 25.00
45 Czech Republic 10702 28.00
175 Trinidad and Tobago 1341 29.00
9 Austria 8495 29.00
89 Kiribati 102 30.00
57 Estonia 1287 32.00
90 Kuwait 3369 33.00
171 The former Yugoslav republic of Macedonia 2107 33.00
41 Costa Rica 4872 33.00
155 Slovakia 5450 35.00
86 Jordan 7274 35.00
43 Cuba 11266 37.00
59 Fiji 881 37.00
186 Uruguay 3407 40.00
94 Lebanon 4822 42.00
93 Latvia 2050 43.00
8 Australia 23343 45.00
42 Croatia 4290 52.00
38 Comoros 735 58.00
54 El Salvador 6340 61.00
32 Canada 35182 62.00
182 United Arab Emirates 9346 64.00
55 Equatorial Guinea 757 67.00
67 Greece 11128 77.00
75 Hungary 9955 81.00
157 Solomon Islands 561 81.00
19 Bhutan 754 88.00
154 Singapore 5412 94.00
72 Guyana 800 130.00
112 Mongolia 2839 140.00
136 Portugal 10608 140.00
25 Bulgaria 7223 150.00
29 Cabo Verde 499 150.00
151 Serbia 9511 150.00
122 Nicaragua 6080 160.00
7 Armenia 2977 170.00
130 Panama 3864 180.00
21 Bosnia and Herzegovina 3829 190.00
132 Paraguay 6802 200.00
35 Chile 17620 220.00
74 Honduras 8098 230.00
176 Tunisia 10997 230.00
161 Spain 46927 240.00
69 Guatemala 15468 250.00
98 Lithuania 3017 250.00
65 Germany 82727 300.00
177 Turkey 74933 310.00
83 Italy 60990 310.00
64 Georgia 4341 310.00
52 Ecuador 15738 320.00
61 France 64291 340.00
183 United Kingdom of Great Britain and Northern I... 63136 340.00
10 Azerbaijan 9413 360.00
63 Gambia 1849 370.00
20 Bolivia (Plurinational State of) 10671 430.00
22 Botswana 2021 440.00
168 Syrian Arab Republic 21898 450.00
139 Republic of Moldova 3487 480.00
189 Venezuela (Bolivarian Republic of) 30405 480.00
185 United States of America 320051 490.00
97 Libya 6202 540.00
53 Egypt 82056 550.00
169 Tajikistan 8208 570.00
6 Argentina 41446 570.00
51 Dominican Republic 10404 590.00
91 Kyrgyzstan 5548 620.00
135 Poland 38217 650.00
37 Colombia 48321 770.00
80 Iraq 33765 780.00
142 Rwanda 11777 810.00
173 Togo 6817 810.00
15 Belarus 9357 850.00
49 Djibouti 873 870.00
62 Gabon 1672 910.00
95 Lesotho 2074 960.00
149 Saudi Arabia 28829 960.00
172 Timor-Leste 1133 990.00
191 Yemen 24407 990.00
107 Mauritania 3890 1000.00
66 Ghana 25905 1100.00
165 Swaziland 1250 1100.00
56 Eritrea 6333 1200.00
140 Romania 21699 1200.00
71 Guinea-Bissau 1704 1200.00
117 Namibia 2303 1300.00
18 Benin 10323 1300.00
162 Sri Lanka 21273 1300.00
178 Turkmenistan 5240 1300.00
101 Malawi 16363 1500.00
26 Burkina Faso 16935 1500.00
104 Mali 15302 1600.00
87 Kazakhstan 16441 1600.00
102 Malaysia 29717 1700.00
39 Congo 4448 2000.00
85 Japan 127144 2100.00
96 Liberia 4294 2100.00
33 Central African Republic 4616 2200.00
187 Uzbekistan 28934 2200.00
109 Mexico 122332 2200.00
27 Burundi 10163 2300.00
133 Peru 30376 2300.00
131 Papua New Guinea 7321 2400.00
79 Iran (Islamic Republic of) 77447 2500.00
153 Sierra Leone 6092 2600.00
138 Republic of Korea 49263 2600.00
73 Haiti 10317 2700.00
114 Morocco 33008 2800.00
150 Senegal 14133 2900.00
34 Chad 12825 2900.00
123 Niger 17831 3100.00
70 Guinea 11745 3200.00
92 Lao People's Democratic Republic 6770 3600.00
192 Zambia 14539 3600.00
28 Côte d'Ivoire 20316 4000.00
180 Uganda 37579 4100.00
23 Brazil 200362 4400.00
160 South Sudan 11296 4500.00
119 Nepal 27797 4600.00
2 Algeria 39208 5100.00
193 Zimbabwe 14150 5700.00
184 United Republic of Tanzania 49253 6000.00
181 Ukraine 45239 6600.00
46 Democratic People's Republic of Korea 24895 6700.00
4 Angola 21472 6900.00
158 Somalia 10496 7700.00
31 Cameroon 22254 7800.00
170 Thailand 67010 8100.00
88 Kenya 44354 9100.00
163 Sudan 37964 9700.00
30 Cambodia 15135 10000.00
100 Madagascar 22925 12000.00
0 Afghanistan 30552 13000.00
141 Russian Federation 142834 17000.00
190 Viet Nam 91680 17000.00
115 Mozambique 25834 18000.00
159 South Africa 52776 25000.00
116 Myanmar 53259 26000.00
134 Philippines 98394 27000.00
58 Ethiopia 94101 30000.00
36 China 1393337 41000.00
47 Democratic Republic of the Congo 67514 46000.00
128 Pakistan 182143 49000.00
78 Indonesia 249866 64000.00
13 Bangladesh 156595 80000.00
124 Nigeria 173615 160000.00
77 India 1252140 240000.00

The table raises the possibility that a large number of deaths may be partly due to a large population. To compare the countries on an equal footing, the death rate per 100,000 inhabitants is computed below:

In [60]:
populationColumn = data['Population (1000s)']
data['TB deaths (per 100,000)'] = tbColumn * 100 / populationColumn
data = data.sort('TB deaths (per 100,000)') 
data
Out[60]:
Country Population (1000s) TB deaths TB deaths (per 100,000)
147 San Marino 31 0.00 0.000000
111 Monaco 38 0.03 0.078947
126 Norway 5043 4.40 0.087250
120 Netherlands 16759 20.00 0.119339
137 Qatar 2169 2.70 0.124481
166 Sweden 9571 13.00 0.135827
121 New Zealand 4506 6.30 0.139814
185 United States of America 320051 490.00 0.153101
16 Belgium 11104 18.00 0.162104
32 Canada 35182 62.00 0.176226
8 Australia 23343 45.00 0.192777
113 Montenegro 621 1.20 0.193237
44 Cyprus 1141 2.30 0.201578
82 Israel 7733 16.00 0.206905
167 Switzerland 8078 17.00 0.210448
45 Czech Republic 10702 28.00 0.261633
76 Iceland 330 0.93 0.281818
60 Finland 5426 17.00 0.313306
43 Cuba 11266 37.00 0.328422
3 Andorra 79 0.26 0.329114
9 Austria 8495 29.00 0.341377
105 Malta 429 1.50 0.349650
65 Germany 82727 300.00 0.362639
81 Ireland 4627 18.00 0.389021
177 Turkey 74933 310.00 0.413703
99 Luxembourg 530 2.20 0.415094
48 Denmark 5619 24.00 0.427122
11 Bahamas 377 1.80 0.477454
86 Jordan 7274 35.00 0.481166
83 Italy 60990 310.00 0.508280
161 Spain 46927 240.00 0.511433
61 France 64291 340.00 0.528845
183 United Kingdom of Great Britain and Northern I... 63136 340.00 0.538520
84 Jamaica 2784 17.00 0.610632
1 Albania 3173 20.00 0.630318
155 Slovakia 5450 35.00 0.642202
53 Egypt 82056 550.00 0.670274
41 Costa Rica 4872 33.00 0.677340
182 United Arab Emirates 9346 64.00 0.684785
127 Oman 3632 25.00 0.688326
67 Greece 11128 77.00 0.691948
14 Barbados 285 2.00 0.701754
12 Bahrain 1332 9.60 0.720721
75 Hungary 9955 81.00 0.813661
94 Lebanon 4822 42.00 0.871008
54 El Salvador 6340 61.00 0.962145
90 Kuwait 3369 33.00 0.979519
125 Niue 1 0.01 1.000000
156 Slovenia 2072 21.00 1.013514
68 Grenada 106 1.10 1.037736
186 Uruguay 3407 40.00 1.174053
108 Mauritius 1244 15.00 1.205788
144 Saint Lucia 182 2.20 1.208791
42 Croatia 4290 52.00 1.212121
35 Chile 17620 220.00 1.248581
136 Portugal 10608 140.00 1.319759
5 Antigua and Barbuda 90 1.20 1.333333
6 Argentina 41446 570.00 1.375284
152 Seychelles 93 1.40 1.505376
171 The former Yugoslav republic of Macedonia 2107 33.00 1.566208
151 Serbia 9511 150.00 1.577121
189 Venezuela (Bolivarian Republic of) 30405 480.00 1.578688
37 Colombia 48321 770.00 1.593510
69 Guatemala 15468 250.00 1.616240
85 Japan 127144 2100.00 1.651671
135 Poland 38217 650.00 1.700814
129 Palau 21 0.36 1.714286
154 Singapore 5412 94.00 1.736881
109 Mexico 122332 2200.00 1.798385
40 Cook Islands 21 0.41 1.952381
52 Ecuador 15738 320.00 2.033295
168 Syrian Arab Republic 21898 450.00 2.054982
25 Bulgaria 7223 150.00 2.076699
176 Tunisia 10997 230.00 2.091479
93 Latvia 2050 43.00 2.097561
175 Trinidad and Tobago 1341 29.00 2.162565
23 Brazil 200362 4400.00 2.196025
103 Maldives 345 7.60 2.202899
164 Suriname 539 12.00 2.226345
80 Iraq 33765 780.00 2.310084
174 Tonga 105 2.50 2.380952
57 Estonia 1287 32.00 2.486402
122 Nicaragua 6080 160.00 2.631579
74 Honduras 8098 230.00 2.840207
145 Saint Vincent and the Grenadines 109 3.10 2.844037
132 Paraguay 6802 200.00 2.940312
36 China 1393337 41000.00 2.942576
143 Saint Kitts and Nevis 54 1.60 2.962963
24 Brunei Darussalam 418 13.00 3.110048
146 Samoa 190 6.10 3.210526
79 Iran (Islamic Republic of) 77447 2500.00 3.228014
149 Saudi Arabia 28829 960.00 3.329980
50 Dominica 72 2.70 3.750000
10 Azerbaijan 9413 360.00 3.824498
20 Bolivia (Plurinational State of) 10671 430.00 4.029613
191 Yemen 24407 990.00 4.056213
59 Fiji 881 37.00 4.199773
66 Ghana 25905 1100.00 4.246285
130 Panama 3864 180.00 4.658385
112 Mongolia 2839 140.00 4.931314
21 Bosnia and Herzegovina 3829 190.00 4.962131
138 Republic of Korea 49263 2600.00 5.277795
140 Romania 21699 1200.00 5.530209
51 Dominican Republic 10404 590.00 5.670896
7 Armenia 2977 170.00 5.710447
102 Malaysia 29717 1700.00 5.720631
17 Belize 332 20.00 6.024096
162 Sri Lanka 21273 1300.00 6.111033
188 Vanuatu 253 16.00 6.324111
118 Nauru 10 0.67 6.700000
142 Rwanda 11777 810.00 6.877813
169 Tajikistan 8208 570.00 6.944444
64 Georgia 4341 310.00 7.141212
133 Peru 30376 2300.00 7.571767
187 Uzbekistan 28934 2200.00 7.603511
38 Comoros 735 58.00 7.891156
98 Lithuania 3017 250.00 8.286377
114 Morocco 33008 2800.00 8.482792
97 Libya 6202 540.00 8.706869
55 Equatorial Guinea 757 67.00 8.850727
26 Burkina Faso 16935 1500.00 8.857396
15 Belarus 9357 850.00 9.084108
101 Malawi 16363 1500.00 9.167023
148 Sao Tome and Principe 193 18.00 9.326425
87 Kazakhstan 16441 1600.00 9.731768
104 Mali 15302 1600.00 10.456150
180 Uganda 37579 4100.00 10.910349
91 Kyrgyzstan 5548 620.00 11.175198
19 Bhutan 754 88.00 11.671088
173 Togo 6817 810.00 11.882060
141 Russian Federation 142834 17000.00 11.901928
170 Thailand 67010 8100.00 12.087748
184 United Republic of Tanzania 49253 6000.00 12.181999
18 Benin 10323 1300.00 12.593238
2 Algeria 39208 5100.00 13.007549
139 Republic of Moldova 3487 480.00 13.765414
157 Solomon Islands 561 81.00 14.438503
181 Ukraine 45239 6600.00 14.589182
72 Guyana 800 130.00 16.250000
119 Nepal 27797 4600.00 16.548548
123 Niger 17831 3100.00 17.385452
190 Viet Nam 91680 17000.00 18.542757
56 Eritrea 6333 1200.00 18.948366
77 India 1252140 240000.00 19.167186
28 Côte d'Ivoire 20316 4000.00 19.688915
63 Gambia 1849 370.00 20.010817
88 Kenya 44354 9100.00 20.516752
150 Senegal 14133 2900.00 20.519352
110 Micronesia (Federated States of) 104 22.00 21.153846
22 Botswana 2021 440.00 21.771400
34 Chad 12825 2900.00 22.612086
27 Burundi 10163 2300.00 22.631113
192 Zambia 14539 3600.00 24.760988
178 Turkmenistan 5240 1300.00 24.809160
163 Sudan 37964 9700.00 25.550522
78 Indonesia 249866 64000.00 25.613729
107 Mauritania 3890 1000.00 25.706941
73 Haiti 10317 2700.00 26.170398
128 Pakistan 182143 49000.00 26.901940
46 Democratic People's Republic of Korea 24895 6700.00 26.913035
70 Guinea 11745 3200.00 27.245636
134 Philippines 98394 27000.00 27.440698
179 Tuvalu 10 2.80 28.000000
89 Kiribati 102 30.00 29.411765
29 Cabo Verde 499 150.00 30.060120
58 Ethiopia 94101 30000.00 31.880639
4 Angola 21472 6900.00 32.134873
131 Papua New Guinea 7321 2400.00 32.782407
31 Cameroon 22254 7800.00 35.049879
106 Marshall Islands 53 21.00 39.622642
160 South Sudan 11296 4500.00 39.837110
193 Zimbabwe 14150 5700.00 40.282686
0 Afghanistan 30552 13000.00 42.550406
153 Sierra Leone 6092 2600.00 42.678923
39 Congo 4448 2000.00 44.964029
95 Lesotho 2074 960.00 46.287367
159 South Africa 52776 25000.00 47.370017
33 Central African Republic 4616 2200.00 47.660312
116 Myanmar 53259 26000.00 48.818040
96 Liberia 4294 2100.00 48.905449
13 Bangladesh 156595 80000.00 51.087199
100 Madagascar 22925 12000.00 52.344602
92 Lao People's Democratic Republic 6770 3600.00 53.175775
62 Gabon 1672 910.00 54.425837
117 Namibia 2303 1300.00 56.448111
30 Cambodia 15135 10000.00 66.072019
47 Democratic Republic of the Congo 67514 46000.00 68.134017
115 Mozambique 25834 18000.00 69.675621
71 Guinea-Bissau 1704 1200.00 70.422535
158 Somalia 10496 7700.00 73.361280
172 Timor-Leste 1133 990.00 87.378641
165 Swaziland 1250 1100.00 88.000000
124 Nigeria 173615 160000.00 92.157936
49 Djibouti 873 870.00 99.656357
In [61]:
print("\nUsing the table above, it can be seen that:\n")           
print(u"\u2022 the two least affected countries were " + str(data['Country'].iloc[0]) + " and " + str(data['Country'].iloc[1]) + " with about " + str(roundToInt(data['TB deaths (per 100,000)'].iloc[1])) + " deaths per 100 thousand inhabitants.\n")
print(u"\u2022 the two worst affected countries were " + str(data['Country'].iloc[-1]) + " and " + str(data['Country'].iloc[-2]) + " with over " + str(roundToInt(data['TB deaths (per 100,000)'].iloc[-2])) + " deaths per 100 thousand inhabitants.")
Using the table above, it can be seen that:

• the two least affected countries were San Marino and Monaco with about 0 deaths per 100 thousand inhabitants.

• the two worst affected countries were Djibouti and Nigeria with over 90 deaths per 100 thousand inhabitants.

Conclusions

There were over a million deaths due to TB in 2013. The median shows that half of these coutries had fewer than 315 deaths. The much higher mean (over 5,500) indicates that some countries had a very high number. The least affected were San Marino and Niue, with 0 and 0.01 deaths respectively. The most affected were Nigeria and India with 160 thousand and 240 thousand deaths in a single year. However, taking the population size into account, the least affected were San Marino and Monaco with less than 0.08 deaths per 100 thousand inhabitants, and the most affected were Nigeria and Djibouti with over 90 deaths per 100,000 inhabitants.

One should not forget that most values are estimates, and that the chosen countries are a small sample of all the world's countries. Nevertheless, they convey the message that TB is still a major cause of fatalities, and that there is a huge disparity between countries, with several ones being highly affected.

In [62]:
print("\nPandas version", pandas.__version__, end="")
from IPython.display import HTML
HTML('''<script>  
function toggler() { 
$('div.input').toggle(); 
location.href="#Bottom";
} 
</script>
<p style="display:inline;"><center>Click <a href="javascript:toggler();">here</a> to toggle code visibility on/off</center></p>
<script>
$('div.input').show();
location.href="#Top";</script></div>''')
Pandas version 0.15.0
Out[62]:

Click here to toggle code visibility on/off

© 2016 Phipps E&OE.