{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Fetching data from GHO\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:33:08.018430Z", "start_time": "2021-05-11T16:33:06.120279Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "source": [ "from ghoclient import GHOSession, index\n", "import pandas as pd\n", "%pylab inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:33:09.276756Z", "start_time": "2021-05-11T16:33:08.900843Z" } }, "outputs": [], "source": [ "GC = GHOSession()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Listing indicator codes" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:33:53.674405Z", "start_time": "2021-05-11T16:33:52.257465Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of available indicators: 3466\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
@Label@DisplaySequence@URLAttrDisplay
0MDG_00000000012https://www.who.int/data/gho/indicator-metadat...[{'@Category': 'DISPLAY_FR', 'Value': {'Displa...Infant mortality rate (probability of dying be...
1MDG_00000000035https://www.who.int/data/gho/indicator-metadat...[{'@Category': 'DEFINITION_XML', 'Value': {'Di...Adolescent birth rate (per 1000 women aged 15-...
2MDG_000000000510https://www.who.int/data/gho/indicator-metadat...[{'@Category': 'CATEGORY', 'Value': {'Display'...Contraceptive prevalence (%)
3MDG_00000000065https://www.who.int/data/gho/indicator-metadat...[{'@Category': 'CATEGORY', 'Value': {'Display'...Unmet need for family planning (%)
4MDG_00000000075https://www.who.int/data/gho/indicator-metadat...[{'@Category': 'DISPLAY_FR', 'Value': {'Displa...Under-five mortality rate (probability of dyin...
\n", "
" ], "text/plain": [ " @Label @DisplaySequence \\\n", "0 MDG_0000000001 2 \n", "1 MDG_0000000003 5 \n", "2 MDG_0000000005 10 \n", "3 MDG_0000000006 5 \n", "4 MDG_0000000007 5 \n", "\n", " @URL \\\n", "0 https://www.who.int/data/gho/indicator-metadat... \n", "1 https://www.who.int/data/gho/indicator-metadat... \n", "2 https://www.who.int/data/gho/indicator-metadat... \n", "3 https://www.who.int/data/gho/indicator-metadat... \n", "4 https://www.who.int/data/gho/indicator-metadat... \n", "\n", " Attr \\\n", "0 [{'@Category': 'DISPLAY_FR', 'Value': {'Displa... \n", "1 [{'@Category': 'DEFINITION_XML', 'Value': {'Di... \n", "2 [{'@Category': 'CATEGORY', 'Value': {'Display'... \n", "3 [{'@Category': 'CATEGORY', 'Value': {'Display'... \n", "4 [{'@Category': 'DISPLAY_FR', 'Value': {'Displa... \n", "\n", " Display \n", "0 Infant mortality rate (probability of dying be... \n", "1 Adolescent birth rate (per 1000 women aged 15-... \n", "2 Contraceptive prevalence (%) \n", "3 Unmet need for family planning (%) \n", "4 Under-five mortality rate (probability of dyin... " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "codes = GC.get_data_codes(format='dataframe')\n", "print(f\"Number of available indicators: {len(codes)}\")\n", "codes.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Serching by keyword\n", "Since the codes are not exactly mnemonic, we can search for all codes about tuberculosis, for example." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:38:32.695928Z", "start_time": "2021-05-11T16:38:32.675866Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codedescription
0TB_1Tuberculosis treatment coverage
1UHC_TB_DTTuberculosis detection and treatment
2WHS3_522Number of reported cases of tuberculosis
3TB_e_prev_numNumber of prevalent tuberculosis cases
4TB_e_inc_numNumber of incident tuberculosis cases
5TB_tot_newrelTuberculosis - new and relapse cases
6TB_newincTuberculosis - new and relapse cases
7TB_c_newincTuberculosis - new and relapse cases
8TB_effective_treatment_coverageTuberculosis effective treatment coverage (%)
9MDG_0000000022Tuberculosis detection rate under DOTS (%)
10MDG_0000000024Tuberculosis treatment success under DOTS (%)
11WHS3_54Number of reported cases of tuberculosis (DOTS)
12MDG_0000000023Prevalence of tuberculosis (per 100 000 popula...
13MDG_0000000030Smear-positive tuberculosis case-detection rat...
14MDG_0000000031Smear-positive tuberculosis treatment-success ...
15TB_e_mort_exc_tbhiv_numNumber of deaths due to tuberculosis, excludin...
16TB_8_c_cdrCase detection rate for all forms of tuberculosis
17TB_e_inc_tbhiv_numNumber of incident tuberculosis cases, (HIV-p...
18TB_e_inc_num_014Number of incident tuberculosis cases in child...
19MDG_0000000020Incidence of tuberculosis (per 100 000 populat...
20TB_e_inc_tbhiv_100kIncidence of tuberculosis (per 100 000 populat...
21TB_c_lab_cul_5mLaboratories providing tuberculosis diagnostic...
22TB_c_new_snep_tsrTreatment success rate for new pulmonary smear...
23MDG_0000000017Deaths due to tuberculosis among HIV-negative ...
24MDG_0000000018Deaths due to tuberculosis among HIV-positive ...
25TB_c_lab_sm_100kLaboratories providing tuberculosis diagnostic...
\n", "
" ], "text/plain": [ " code \\\n", "0 TB_1 \n", "1 UHC_TB_DT \n", "2 WHS3_522 \n", "3 TB_e_prev_num \n", "4 TB_e_inc_num \n", "5 TB_tot_newrel \n", "6 TB_newinc \n", "7 TB_c_newinc \n", "8 TB_effective_treatment_coverage \n", "9 MDG_0000000022 \n", "10 MDG_0000000024 \n", "11 WHS3_54 \n", "12 MDG_0000000023 \n", "13 MDG_0000000030 \n", "14 MDG_0000000031 \n", "15 TB_e_mort_exc_tbhiv_num \n", "16 TB_8_c_cdr \n", "17 TB_e_inc_tbhiv_num \n", "18 TB_e_inc_num_014 \n", "19 MDG_0000000020 \n", "20 TB_e_inc_tbhiv_100k \n", "21 TB_c_lab_cul_5m \n", "22 TB_c_new_snep_tsr \n", "23 MDG_0000000017 \n", "24 MDG_0000000018 \n", "25 TB_c_lab_sm_100k \n", "\n", " description \n", "0 Tuberculosis treatment coverage \n", "1 Tuberculosis detection and treatment \n", "2 Number of reported cases of tuberculosis \n", "3 Number of prevalent tuberculosis cases \n", "4 Number of incident tuberculosis cases \n", "5 Tuberculosis - new and relapse cases \n", "6 Tuberculosis - new and relapse cases \n", "7 Tuberculosis - new and relapse cases \n", "8 Tuberculosis effective treatment coverage (%) \n", "9 Tuberculosis detection rate under DOTS (%) \n", "10 Tuberculosis treatment success under DOTS (%) \n", "11 Number of reported cases of tuberculosis (DOTS) \n", "12 Prevalence of tuberculosis (per 100 000 popula... \n", "13 Smear-positive tuberculosis case-detection rat... \n", "14 Smear-positive tuberculosis treatment-success ... \n", "15 Number of deaths due to tuberculosis, excludin... \n", "16 Case detection rate for all forms of tuberculosis \n", "17 Number of incident tuberculosis cases, (HIV-p... \n", "18 Number of incident tuberculosis cases in child... \n", "19 Incidence of tuberculosis (per 100 000 populat... \n", "20 Incidence of tuberculosis (per 100 000 populat... \n", "21 Laboratories providing tuberculosis diagnostic... \n", "22 Treatment success rate for new pulmonary smear... \n", "23 Deaths due to tuberculosis among HIV-negative ... \n", "24 Deaths due to tuberculosis among HIV-positive ... \n", "25 Laboratories providing tuberculosis diagnostic... " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "index.build_index(codes)\n", "results = index.search('tuberculosis')\n", "results = pd.DataFrame(results)\n", "results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's look at the \"Incidence of tuberculosis (per 100 000 population per year)\": `MDG_0000000020`" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:37:33.102083Z", "start_time": "2021-05-11T16:37:22.543391Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
GHOPUBLISHSTATEYEARREGIONWORLDBANKINCOMEGROUPCOUNTRYDisplay ValueNumericLowHighComments
15MDG_0000000020PUBLISHED2006AFRNaNNaN356 [312-404]356.0312.0404.0NaN
16MDG_0000000020PUBLISHED2013AFRNaNNaN291 [258-326]291.0258.0326.0NaN
17MDG_0000000020PUBLISHED2015AFRNaNNaN270 [240-302]270.0240.0302.0NaN
40MDG_0000000020PUBLISHED2004AFRNaNAGO350 [227-500]350.0227.0500.0NaN
41MDG_0000000020PUBLISHED2013AFRNaNAGO376 [243-537]376.0243.0537.0NaN
....................................
4056MDG_0000000020PUBLISHED2018AFRNaNUGA200 [118-304]200.0118.0304.0NaN
4073MDG_0000000020PUBLISHED2013AFRNaNZAF1110 [770-1500]1110.0770.01500.0NaN
4074MDG_0000000020PUBLISHED2016AFRNaNZAF805 [561-1090]805.0561.01090.0NaN
4075MDG_0000000020PUBLISHED2013AFRNaNZMB437 [283-625]437.0283.0625.0NaN
4076MDG_0000000020PUBLISHED2010AFRNaNZWE416 [324-518]416.0324.0518.0NaN
\n", "

949 rows × 11 columns

\n", "
" ], "text/plain": [ " GHO PUBLISHSTATE YEAR REGION WORLDBANKINCOMEGROUP COUNTRY \\\n", "15 MDG_0000000020 PUBLISHED 2006 AFR NaN NaN \n", "16 MDG_0000000020 PUBLISHED 2013 AFR NaN NaN \n", "17 MDG_0000000020 PUBLISHED 2015 AFR NaN NaN \n", "40 MDG_0000000020 PUBLISHED 2004 AFR NaN AGO \n", "41 MDG_0000000020 PUBLISHED 2013 AFR NaN AGO \n", "... ... ... ... ... ... ... \n", "4056 MDG_0000000020 PUBLISHED 2018 AFR NaN UGA \n", "4073 MDG_0000000020 PUBLISHED 2013 AFR NaN ZAF \n", "4074 MDG_0000000020 PUBLISHED 2016 AFR NaN ZAF \n", "4075 MDG_0000000020 PUBLISHED 2013 AFR NaN ZMB \n", "4076 MDG_0000000020 PUBLISHED 2010 AFR NaN ZWE \n", "\n", " Display Value Numeric Low High Comments \n", "15 356 [312-404] 356.0 312.0 404.0 NaN \n", "16 291 [258-326] 291.0 258.0 326.0 NaN \n", "17 270 [240-302] 270.0 240.0 302.0 NaN \n", "40 350 [227-500] 350.0 227.0 500.0 NaN \n", "41 376 [243-537] 376.0 243.0 537.0 NaN \n", "... ... ... ... ... ... \n", "4056 200 [118-304] 200.0 118.0 304.0 NaN \n", "4073 1110 [770-1500] 1110.0 770.0 1500.0 NaN \n", "4074 805 [561-1090] 805.0 561.0 1090.0 NaN \n", "4075 437 [283-625] 437.0 283.0 625.0 NaN \n", "4076 416 [324-518] 416.0 324.0 518.0 NaN \n", "\n", "[949 rows x 11 columns]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = GC.fetch_data_from_codes(code='MDG_0000000020')\n", "data = data[(data.REGION=='AFR')]\n", "data" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2020-06-30T17:56:26.365292Z", "start_time": "2020-06-30T17:56:26.335785Z" }, "scrolled": false }, "source": [ "Now let's find indicators related to water" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:39:34.876725Z", "start_time": "2021-05-11T16:39:34.853713Z" }, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codedescription
0WAS_0000000001Access to improved drinking water sources
1EQ_HANDWASHINGHouseholds with soap and water at a handwashin...
2WSH_10_WATNumber of diarrhoea deaths from inadequate water
3WSH_20_WATAttributable fraction of diarrhoea to inadequa...
4WSH_30_WATNumber of diarrhoea DALYs from inadequate water
5RADON_Q405Radon in national drinking-water regulations
6WHS5_122Population using improved drinking-water sourc...
7WSH_5Water, sanitation and hygiene attributable DAL...
8EQ_WATERPopulation using improved drinking-water sourc...
9EQ_WATERIMPROVEDHouseholds using an improved drinking-water so...
10EQ_WATERPIPEDHouseholds using a piped drinking-water source...
11WSH_09Water, sanitation and hygiene - population att...
12WSH_WATER_SAFELY_MANAGEDPopulation using safely managed drinking-water...
13WSH_WATER_BASICPopulation using at least basic drinking-water...
14WSH_10Number of diarrhoea deaths from inadequate wat...
15WSH_40_WATDiarrhoea deaths from inadequate water in chil...
16WSH_50_WATDiarrhoea DALYs from inadequate water in child...
17WSH_20Attributable fraction of diarrhoea to inadequa...
18WSH_30Number of diarrhoea DALYs from inadequate wate...
19NLIS_NU_CA_017NLIS: Population using improved drinking-water...
20EQ_WATERPREMISESHouseholds using a piped onto premises drinkin...
21WSH_2Water, sanitation and hygiene attributable dea...
22WSH_3Water, sanitation and hygiene attributable dea...
23WSH_6Water, sanitation and hygiene attributable DAL...
24WSH_7Water, sanitation and hygiene attributable DAL...
25WSH_40Diarrhoea deaths from inadequate water, sanita...
26WSH_50Diarrhoea DALYs from inadequate water, sanitat...
27WSH_4Water, sanitation and hygiene attributable de...
28WSH_8Water, sanitation and hygiene attributable DA...
29SDGODAWSAmount of water- and sanitation-related offici...
\n", "
" ], "text/plain": [ " code \\\n", "0 WAS_0000000001 \n", "1 EQ_HANDWASHING \n", "2 WSH_10_WAT \n", "3 WSH_20_WAT \n", "4 WSH_30_WAT \n", "5 RADON_Q405 \n", "6 WHS5_122 \n", "7 WSH_5 \n", "8 EQ_WATER \n", "9 EQ_WATERIMPROVED \n", "10 EQ_WATERPIPED \n", "11 WSH_09 \n", "12 WSH_WATER_SAFELY_MANAGED \n", "13 WSH_WATER_BASIC \n", "14 WSH_10 \n", "15 WSH_40_WAT \n", "16 WSH_50_WAT \n", "17 WSH_20 \n", "18 WSH_30 \n", "19 NLIS_NU_CA_017 \n", "20 EQ_WATERPREMISES \n", "21 WSH_2 \n", "22 WSH_3 \n", "23 WSH_6 \n", "24 WSH_7 \n", "25 WSH_40 \n", "26 WSH_50 \n", "27 WSH_4 \n", "28 WSH_8 \n", "29 SDGODAWS \n", "\n", " description \n", "0 Access to improved drinking water sources \n", "1 Households with soap and water at a handwashin... \n", "2 Number of diarrhoea deaths from inadequate water \n", "3 Attributable fraction of diarrhoea to inadequa... \n", "4 Number of diarrhoea DALYs from inadequate water \n", "5 Radon in national drinking-water regulations \n", "6 Population using improved drinking-water sourc... \n", "7 Water, sanitation and hygiene attributable DAL... \n", "8 Population using improved drinking-water sourc... \n", "9 Households using an improved drinking-water so... \n", "10 Households using a piped drinking-water source... \n", "11 Water, sanitation and hygiene - population att... \n", "12 Population using safely managed drinking-water... \n", "13 Population using at least basic drinking-water... \n", "14 Number of diarrhoea deaths from inadequate wat... \n", "15 Diarrhoea deaths from inadequate water in chil... \n", "16 Diarrhoea DALYs from inadequate water in child... \n", "17 Attributable fraction of diarrhoea to inadequa... \n", "18 Number of diarrhoea DALYs from inadequate wate... \n", "19 NLIS: Population using improved drinking-water... \n", "20 Households using a piped onto premises drinkin... \n", "21 Water, sanitation and hygiene attributable dea... \n", "22 Water, sanitation and hygiene attributable dea... \n", "23 Water, sanitation and hygiene attributable DAL... \n", "24 Water, sanitation and hygiene attributable DAL... \n", "25 Diarrhoea deaths from inadequate water, sanita... \n", "26 Diarrhoea DALYs from inadequate water, sanitat... \n", "27 Water, sanitation and hygiene attributable de... \n", "28 Water, sanitation and hygiene attributable DA... \n", "29 Amount of water- and sanitation-related offici... " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "water_codes = index.search('water')\n", "pd.DataFrame(water_codes)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Not all indicators are available for all countries in recent years, so we can easily check what's available." ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:47:25.343538Z", "start_time": "2021-05-11T16:47:12.019412Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Checking WAS_0000000001: Access to improved drinking water sources\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking EQ_HANDWASHING: Households with soap and water at a handwashing facility (%)\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_10_WAT: Number of diarrhoea deaths from inadequate water\n", "\tLatest year available for WSH_10_WAT in Africa: 2016\n", "\tCode available on all countries for 2016\n", "Checking WSH_20_WAT: Attributable fraction of diarrhoea to inadequate water\n", "\tLatest year available for WSH_20_WAT in Africa: 2016\n", "Checking WSH_30_WAT: Number of diarrhoea DALYs from inadequate water\n", "\tLatest year available for WSH_30_WAT in Africa: 2016\n", "\tCode available on all countries for 2016\n", "Checking RADON_Q405: Radon in national drinking-water regulations\n", "\tLatest year available for RADON_Q405 in Africa: 2019\n", "Checking WHS5_122: Population using improved drinking-water sources (%)\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_5: Water, sanitation and hygiene attributable DALYs ('000)\n", "\tLatest year available for WSH_5 in Africa: 2004\n", "Checking EQ_WATER: Population using improved drinking-water sources (%)\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking EQ_WATERIMPROVED: Households using an improved drinking-water source (%)\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking EQ_WATERPIPED: Households using a piped drinking-water source (%)\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_09: Water, sanitation and hygiene - population attributable fractions\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_WATER_SAFELY_MANAGED: Population using safely managed drinking-water services (%)\n", "\tLatest year available for WSH_WATER_SAFELY_MANAGED in Africa: 2017\n", "Checking WSH_WATER_BASIC: Population using at least basic drinking-water services (%)\n", "\tLatest year available for WSH_WATER_BASIC in Africa: 2017\n", "\tCode available on all countries for 2017\n", "Checking WSH_10: Number of diarrhoea deaths from inadequate water, sanitation and hygiene\n", "\tLatest year available for WSH_10 in Africa: 2016\n", "\tCode available on all countries for 2016\n", "Checking WSH_40_WAT: Diarrhoea deaths from inadequate water in children under 5 years\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_50_WAT: Diarrhoea DALYs from inadequate water in children under 5 years\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_20: Attributable fraction of diarrhoea to inadequate water, sanitation and hygiene\n", "\tLatest year available for WSH_20 in Africa: 2016\n", "Checking WSH_30: Number of diarrhoea DALYs from inadequate water, sanitation and hygiene\n", "\tLatest year available for WSH_30 in Africa: 2016\n", "\tCode available on all countries for 2016\n", "Checking NLIS_NU_CA_017: NLIS: Population using improved drinking-water sources (%)\n", "\tLatest year available for NLIS_NU_CA_017 in Africa: 2017\n", "Checking EQ_WATERPREMISES: Households using a piped onto premises drinking-water source (%)\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_2: Water, sanitation and hygiene attributable deaths ('000) in children under 5 years\n", "\tLatest year available for WSH_2 in Africa: 2004\n", "Checking WSH_3: Water, sanitation and hygiene attributable deaths per 100'000 capita\n", "\tLatest year available for WSH_3 in Africa: 2004\n", "Checking WSH_6: Water, sanitation and hygiene attributable DALYs ('000) in children under 5 years\n", "\tLatest year available for WSH_6 in Africa: 2004\n", "Checking WSH_7: Water, sanitation and hygiene attributable DALYs per 100'000 capita\n", "\tLatest year available for WSH_7 in Africa: 2004\n", "Checking WSH_40: Diarrhoea deaths from inadequate water, sanitation and hygiene in children under 5 years\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_50: Diarrhoea DALYs from inadequate water, sanitation and hygiene in children under 5 years\n", "\tno data available:\n", "\t 'DataFrame' object has no attribute 'REGION'\n", "Checking WSH_4: Water, sanitation and hygiene attributable deaths per 100'000 children under 5 years\n", "\tLatest year available for WSH_4 in Africa: 2004\n", "Checking WSH_8: Water, sanitation and hygiene attributable DALYs per 100'000 children under 5 years\n", "\tLatest year available for WSH_8 in Africa: 2004\n", "Checking SDGODAWS: Amount of water- and sanitation-related official development assistance that is part of a government-coordinated spending plan (current US$ millions)\n", "\tLatest year available for SDGODAWS in Africa: nan\n" ] } ], "source": [ "for c in water_codes:\n", " print(f\"Checking {c['code']}: {c['description']}\")\n", " data = GC.fetch_data_from_codes(code=c['code'])\n", " try:\n", " data = data[(data.REGION=='AFR')&(data.YEAR==data.YEAR.max())]\n", " print(f\"\\tLatest year available for {c['code']} in Africa: {data.YEAR.max()}\")\n", " except AttributeError as e:\n", " print(\"\\tno data available:\\n\\t \", e)\n", " if len(data) >=54:\n", " print(f\"\\tCode available on all countries for {data.YEAR.max()}\")" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "ExecuteTime": { "end_time": "2021-05-11T16:45:45.328322Z", "start_time": "2021-05-11T16:45:44.344529Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
GHOPUBLISHSTATEYEARREGIONCOUNTRYRESIDENCEAREATYPEDisplay ValueNumericLowHighComments
159WSH_WATER_BASICPUBLISHED2017AFRDZARUR89.088.69096NaNNaNNaN
160WSH_WATER_BASICPUBLISHED2017AFRDZATOTL94.093.55589NaNNaNNaN
161WSH_WATER_BASICPUBLISHED2017AFRDZAURB95.095.44293NaNNaNNaN
267WSH_WATER_BASICPUBLISHED2017AFRAGORUR27.027.44429NaNNaNNaN
268WSH_WATER_BASICPUBLISHED2017AFRAGOTOTL56.055.84290NaNNaNNaN
....................................
10420WSH_WATER_BASICPUBLISHED2017AFRZMBTOTL60.059.96376NaNNaNNaN
10421WSH_WATER_BASICPUBLISHED2017AFRZMBURB84.083.86312NaNNaNNaN
10473WSH_WATER_BASICPUBLISHED2017AFRZWERUR50.049.80476NaNNaNNaN
10474WSH_WATER_BASICPUBLISHED2017AFRZWETOTL64.064.05123NaNNaNNaN
10475WSH_WATER_BASICPUBLISHED2017AFRZWEURB94.093.99767NaNNaNNaN
\n", "

141 rows × 11 columns

\n", "
" ], "text/plain": [ " GHO PUBLISHSTATE YEAR REGION COUNTRY RESIDENCEAREATYPE \\\n", "159 WSH_WATER_BASIC PUBLISHED 2017 AFR DZA RUR \n", "160 WSH_WATER_BASIC PUBLISHED 2017 AFR DZA TOTL \n", "161 WSH_WATER_BASIC PUBLISHED 2017 AFR DZA URB \n", "267 WSH_WATER_BASIC PUBLISHED 2017 AFR AGO RUR \n", "268 WSH_WATER_BASIC PUBLISHED 2017 AFR AGO TOTL \n", "... ... ... ... ... ... ... \n", "10420 WSH_WATER_BASIC PUBLISHED 2017 AFR ZMB TOTL \n", "10421 WSH_WATER_BASIC PUBLISHED 2017 AFR ZMB URB \n", "10473 WSH_WATER_BASIC PUBLISHED 2017 AFR ZWE RUR \n", "10474 WSH_WATER_BASIC PUBLISHED 2017 AFR ZWE TOTL \n", "10475 WSH_WATER_BASIC PUBLISHED 2017 AFR ZWE URB \n", "\n", " Display Value Numeric Low High Comments \n", "159 89.0 88.69096 NaN NaN NaN \n", "160 94.0 93.55589 NaN NaN NaN \n", "161 95.0 95.44293 NaN NaN NaN \n", "267 27.0 27.44429 NaN NaN NaN \n", "268 56.0 55.84290 NaN NaN NaN \n", "... ... ... ... ... ... \n", "10420 60.0 59.96376 NaN NaN NaN \n", "10421 84.0 83.86312 NaN NaN NaN \n", "10473 50.0 49.80476 NaN NaN NaN \n", "10474 64.0 64.05123 NaN NaN NaN \n", "10475 94.0 93.99767 NaN NaN NaN \n", "\n", "[141 rows x 11 columns]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = GC.fetch_data_from_codes(code='WSH_WATER_BASIC')\n", "data = data[(data.REGION=='AFR')&(data.YEAR==data.YEAR.max())]\n", "data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autoclose": false, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": true }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }