WDI Data with Python

I will show in this notenook how we can import data from any WDI indicator using Python. To learn more about the WDI data, you need to visit this website.

You need first to install the wbdata module

pip install wbdata

We need first to import the wbdata library

In [1]:
import wbdata

We can know the several sources of the WDI data

In [2]:
wbdata.get_source()
11	Africa Development Indicators
36	Statistical Capacity Indicators
31	Country Policy and Institutional Assessment
41	Country Partnership Strategy for India (FY2013 - 17)
1 	Doing Business
30	Exporter Dynamics Database ��� Indicators at Country-Year Level
12	Education Statistics
60	Economic Fitness
13	Enterprise Surveys
28	Global Financial Inclusion
33	G20 Financial Inclusion Indicators
14	Gender Statistics
15	Global Economic Monitor
27	Global Economic Prospects
32	Global Financial Development
34	Global Partnership for Education
29	The Atlas of Social Protection: Indicators of Resilience and Equity
63	Human Capital Index
16	Health Nutrition and Population Statistics
39	Health Nutrition and Population Statistics by Wealth Quintile
40	Population estimates and projections
62	International Comparison Program (ICP) 2011
18	IDA Results Measurement System
45	Indonesia Database for Policy and Economic Research
6 	International Debt Statistics
54	Joint External Debt Hub
25	Jobs
37	LAC Equity Lab
19	Millennium Development Goals
24	Poverty and Equity
61	PPPs Regulatory Quality
20	Quarterly Public Sector Debt
23	Quarterly External Debt Statistics GDDS
22	Quarterly External Debt Statistics SDDS
44	Readiness for Investment in Sustainable Energy
46	Sustainable Development Goals 
35	Sustainable Energy for All
5 	Subnational Malnutrition Database
38	Subnational Poverty
50	Subnational Population
58	Universal Health Coverage
59	Wealth Accounts
43	Adjusted Net Savings
64	Worldwide Bureaucracy Indicators
2 	World Development Indicators
3 	Worldwide Governance Indicators

For example, here's the indicators provided by the source number 1

In [3]:
wbdata.get_indicator(source=1)
TRD.ACRS.BRDR.RK.DB19                            	Rank: Trading across borders (1=most business-friendly regulations) (DB19 methodology)
TRD.ACRS.BRDR.IMP.TM.DY.DB0615.DFRN              	Trading across borders: Time to import (days) (DB06-15 methodology) - Score
TRD.ACRS.BRDR.IMP.TM.DOC.COMP.HR.DB1619.DFRN     	Trading across borders: Time to import: Documentary compliance (hours) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.IMP.TM.BRDR.COMP.HR.DB1619.DFRN    	Trading across borders: Time to import: Border compliance (hours) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.IMP.DURS.DY.DB0615                 	Time to import (days) (DB06-15 methodology)
TRD.ACRS.BRDR.IMP.DOC.COMP.HR.DB1619             	Time to import: Documentary compliance (hours) (DB16-19 methodology)
TRD.ACRS.BRDR.IMP.COST.DOC.COMP.CD.DB1619.DFRN   	Trading across borders: Cost to import: Documentary compliance (USD) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.IMP.COST.DOC.COMP.CD.DB1619        	Trading across borders: Cost to import: Documentary compliance (USD) (DB16-19 methodology)
TRD.ACRS.BRDR.IMP.COST.CD.DB0615.DFRN            	Trading across borders: Cost to import (US$ per container)(DB06-15 methodology) - Score
TRD.ACRS.BRDR.IMP.COST.CD.DB0615                 	Trading across borders: Cost to import (US$ per container deflated)(DB06-15 methodology)
TRD.ACRS.BRDR.IMP.COST.BRDR.COMP.CD.DB1619.DFRN  	Trading across borders: Cost to import: Border compliance (USD) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.IMP.COST.BRDR.COMP.CD.DB1619       	Trading across borders: Cost to import: Border compliance (USD) (DB16-19 methodology)
TRD.ACRS.BRDR.IMP.BRDR.COMP.HR.DB1619            	Time to import: Border compliance (hours) (DB16-19 methodology)
TRD.ACRS.BRDR.EXPT.TM.DY.DB0615.DFRN             	Trading across borders: Time to export (days) (DB06-15 methodology) - Score
TRD.ACRS.BRDR.EXPT.TM.DOC.COMP.HR.DB1619.DFRN    	Trading across borders: Time to export: Documentary compliance (hours) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.EXPT.TM.BRDR.COMP.HR.DB1619.DFRN   	Trading across borders: Time to export: Border compliance (hours) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.EXPT.DURS.DY.DB0615                	Time to export (days) (DB06-15 methodology)
TRD.ACRS.BRDR.EXPT.COST.DOC.COMP.CD.DB1619.DFRN  	Trading across borders: Cost to export: Documentary compliance (USD) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.EXPT.COST.DOC.COMP.CD.DB1619       	Trading across borders: Cost to export: Documentary compliance (USD) (DB16-19 methodology)
TRD.ACRS.BRDR.EXPT.COST.CD.DB0615.DFRN           	Trading across borders: Cost to export (US$ per container) (DB06-15 methodology) - Score
TRD.ACRS.BRDR.EXPT.COST.CD.DB0615                	Trading across borders: Cost to export (US$ per container deflated) (DB06-15 methodology)
TRD.ACRS.BRDR.EXPT.COST.BRDR.COMP.CD.DB1619.DFRN 	Trading across borders: Cost to export: Border compliance (USD) (DB16-19 methodology) - Score
TRD.ACRS.BRDR.EXPT.COST.BRDR.COMP.CD.DB1619      	Trading across borders: Cost to export: Border compliance (USD) (DB16-19 methodology)
TRD.ACRS.BRDR.EXPT.BRDR.COMP.HR.DB1619           	Time to export: Border compliance (hours) (DB16-19 methodology)
TRD.ACRS.BRDR.DOCS.IMP.NO.DB0615.DFRN            	Trading across borders: Documents to import (number) (DB06-15 methodology) - Score
TRD.ACRS.BRDR.DOCS.IMP.NO.DB0615                 	Trading across borders: Documents to import (number) (DB06-15 methodology)
TRD.ACRS.BRDR.DOCS.EXPT.NO.DB0615.DFRN           	Trading across borders: Documents to export (number) (DB06-15 methodology) - Score
TRD.ACRS.BRDR.DOCS.EXPT.NO.DB0615                	Trading across borders: Documents to export (number) (DB06-15 methodology)
TRD.ACRS.BRDR.DOC.COMP.HR.DB1619                 	Time to export: Documentary compliance (hours) (DB16-19 methodology)
TRD.ACRS.BRDR.DB1619.DFRN                        	Trading across borders (DB16-19 methodology) - Score
TRD.ACRS.BRDR.DB0615.DFRN                        	Trading across borders (DB06-15 methodology) - Score
RESLV.ISV.SOIF.06.DB1519                         	Resolving insolvency: Strength of insolvency framework index (0-16) (DB15-19 methodology)
RESLV.ISV.ROPC.03.XD.DB1519                      	Reorganization proceedings index (0-3) (DB15-19 methodology)
RESLV.ISV.RK.DB19                                	Rank: Resolving insolvency  (DB19 methodology)
RESLV.ISV.RCOV.RT.016.DB1519.DFRN                	Resolving insolvency: Strength of insolvency framework index (0-16) (DB15-19 methodology) - Score
RESLV.ISV.RCOV.RT                                	Resolving insolvency: Recovery rate (cents on the dollar)
RESLV.ISV.OTCM                                   	Resolving insolvency: Outcome (0 as piecemeal sale and 1 as going concern)
RESLV.ISV.MGDA.XD.DB1519                         	Resolving insolvency: Management of debtor's assets index (0-6) (DB15-19 methodology)
RESLV.ISV.DURS.YR                                	Resolving insolvency: Time (years)
RESLV.ISV.DFRN.RCOV.RT                           	Resolving insolvency: Recovery rate (cents on the dollar) - Score
RESLV.ISV.DB1519.DFRN                            	Resolving insolvency (DB15-19 methodology) - Score
RESLV.ISV.DB0414.DFRN                            	Resolving insolvency (DB04-14 methodology) - Score
RESLV.ISV.CPI.04.XD.DB1519                       	Resolving insolvency: Creditor participation index (0-4) (DB15-19 methodology)
RESLV.ISV.COST.ZS                                	Resolving insolvency: Cost (% of estate)
RESLV.ISV.COPR.03.XD.DB1519                      	Resolving insolvency: Commencement of proceedings index (0-3) (DB15-19 methodology)
PROT.MINOR.INV.STRENG.MIN.INV.PROT.XD.010.DB0614 	Protecting minority investors: Strength of minority investor protection index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.STRENG.INV.PROT.XD.010.DB0614     	Protecting minority investors: Strength of investor protection index (0-10) (DB06-14 methodology)
PROT.MINOR.INV.IC.PRIN.MINOR.RK                  	Rank: Protecting minority investors (1=most business-friendly regulations)  (DB19 methodology)
PROT.MINOR.INV.IC.PRIN.EXT.DIR.LGL.010.XD        	Protecting minority investors: Extent of director liability index (0-10)
PROT.MINOR.INV.EXT.SHRHLD.RGT.XD.0010.DB1519.DRFN	Protecting minority investors: Extent of shareholder rights index (0-10) (DB15-19 methodology) - Score
PROT.MINOR.INV.EXT.SHARE.RTS.XD.010.DB1519       	Protecting minority investors: Extent of shareholder rights index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.EXT.SHARE.GOV.XD.010.DB1519       	Protecting minority investors: Extent of shareholder governance index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.EXT.OWNR.CONTL.010.XD.DFRN        	Protecting minority investors: Extent of ownership and control index (0-10) (DB15-19 methodology) - Score
PROT.MINOR.INV.EXT.OWNR.CONT.XD.0100.DB1519      	Protecting minority investors: Extent of ownership and control index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.EXT.DISC.010.XD.DFRN              	Protecting minority investors: Extent of disclosure index (0-10) - Score
PROT.MINOR.INV.EXT.DIR.LBL.010.XD.DFRN           	Protecting minority investors: Extent of director liability index (0-10) - Score
PROT.MINOR.INV.EXT.CORP.TRANS.XD.010.DB1519.DFRN 	Protecting minority investors: Extent of corporate transparency index (0-10) (DB15-19 methodology) - Score
PROT.MINOR.INV.EXT.CORP.TRANP.XD.0010.DB1519     	Protecting minority investors: Extent of corporate transparency index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.EXT.CONFL.INTER.XD.010.DB1519     	Protecting minority investors: Extent of conflict of interest regulation index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.EXT.BUS.DISC.010.XD               	Protecting minority investors: Extent of disclosure index (0-10)
PROT.MINOR.INV.EASE.SSI.XD.0010.DB1519.DFRN      	Protecting minority investors: Ease of shareholder suits index (0-10) (DB15-19 methodology) - Score
PROT.MINOR.INV.EASE.SSI.XD.0010.DB0614.DFRN      	Protecting minority investors: Ease of shareholder suits index (0-10) (DB06-14 methodology) - Score
PROT.MINOR.INV.EASE.SHARE.LGL.XD.010.DB1519      	Protecting minority investors: Ease of shareholder suits index (0-10) (DB15-19 methodology)
PROT.MINOR.INV.EASE.SHARE.LGL.XD.010.DB0614      	Protecting minority investors: Ease of shareholder suits index (0-10) (DB06-14 methodology)
PROT.MINOR.INV.DFRN.DB1519                       	Protecting minority investors (DB15-19 methodology) - Score
PROT.MINOR.INV.DFRN.DB0614                       	Protecting minority investors (DB06-14 methodology) - Score
PAY.TAX.VAT.REFU.COMP.HRS.TM.DB1719.DFRN         	Paying taxes: Time to comply with VAT refund (hours) (DB17-19 methodology) - Score
PAY.TAX.VAT.REFU.COMP.HRS.TM.DB1719              	Paying taxes: Time to comply with VAT refund (hours) (DB17-19 methodology)
PAY.TAX.VAT.REF.OBT.WKS.TM.DB1719.DFRN           	Paying taxes: Time to obtain VAT refund (weeks) (DB17-19 methodology) - Score
PAY.TAX.VAT.REF.OBT.WKS.TM.DB1719                	Paying taxes: Time to obtain VAT refund (weeks) (DB17-19 methodology)
PAY.TAX.TOT.TAX.RT.ZS.DRFRN                      	Paying taxes: Total tax rate (% of profit) - Score
PAY.TAX.TOT.TAX.RT.ZS                            	Paying taxes: Total tax rate (% of profit)
PAY.TAX.TM.DFRN                                  	Paying taxes: Time (hours per year) - Score
PAY.TAX.TM                                       	Paying taxes: Time (hours per year)
PAY.TAX.RK.DB19                                  	Rank: Paying taxes (1=most business-friendly regulations) (DB19 methodology)
PAY.TAX.PYMT.NO.DFRN                             	Paying taxes: Tax payments per year (number) - Score
PAY.TAX.PYMT.FREQ.NO                             	Paying taxes: Payments (number per year)
PAY.TAX.PRFT.CP.ZS                               	Paying taxes: Profit tax (% of profits)
PAY.TAX.POST.FIL.XD.0100.DB1719.DFRN             	Paying taxes: Postfiling index (0-100) (DB17-19 methodology) - Score
PAY.TAX.LABR.TAX.CONTR.ZS                        	Paying taxes: Labor tax and contributions (% of commercial profits)
PAY.TAX.DB1719.DRFN                              	Paying taxes (DB17-19 methodology) - Score
PAY.TAX.DB0616.DFRN                              	Paying taxes (DB06-16 methodology) - Score
PAY.TAX.COIT.WKS.TM.DB1719.DFRN                  	Paying taxes: Time to complete a corporate income tax correction (weeks) (DB17-19 methodology) - Score
PAY.TAX.COIT.AU.WKS.DB1719                       	Paying taxes: Time to complete a corporate income tax correction (weeks) (DB17-19 methodology)
PAY.TAX.COIT.AU.HRS.TM.DB1719.DFRN               	Paying taxes: Time to comply with corporate income tax correction (hours) (DB17-19 methodology) - Score
PAY.TAX.COIT.AU.HRS.DB1719                       	Paying taxes: Time to comply with corporate income tax correction (hours) (DB17-19 methodology)
OTHR.TAX.PAID.ZS                                 	Other taxes (% of profits)
IC.REG.STRT.BUS.RK.DB19                          	Rank: Starting a business (DB19 methodology)
IC.REG.STRT.BUS.DFRN                             	Starting a business - Score
IC.REG.PRRT.TRAP.INFO.XD.06.DB1619               	Registering property: Transparency of information index (0-6) (DB16-19 methodology)
IC.REG.PRRT.RELI.INFR.XD.09.DB1619               	Registering property: Reliability of infrastructure index (0-8) (DB16-19 methodology)
IC.REG.PRRT.REG.RK.DB19                          	Rank: Registering property (1=most business-friendly regulations)  (DB19 methodology)
IC.REG.PRRT.QUAL.LNDADM.XD.030.DB1719            	Registering property: Quality of land administration index (0-30) (DB17-19 methodology)
IC.REG.PRRT.QUAL.LNDADM.XD.030.DB16.DFRN         	Registering property: Quality of land administration index (0-30) (DB16 methodology) - Score
IC.REG.PRRT.QUAL.LNDADM.XD.030.DB16              	Registering property: Quality of land administration index (0-30) (DB16 methodology)
IC.REG.PRRT.PROC.NO.DFRN                         	Registering property: Procedures (number) - Score
IC.REG.PRRT.PROC.NO                              	Registering property: Procedures (number)
IC.REG.PRRT.LNDADM.GEN.XD.030.DB1719.DFRN        	Registering property: Quality of land administration index with Gender (0-30) (DB17-19 methodology) - Score
IC.REG.PRRT.LAND.DISP.XD.08.DB1619               	Registering property: Land dispute resolution index (0-8) (DB16-19 methodology)
IC.REG.PRRT.GEO.COVR.XD.08.DB1619                	Registering property: Geographic coverage index (0-8) (DB16-19 methodology)
IC.REG.PRRT.EQACCS.XD.08.DB1619                  	Registering property: Equal access to property rights index (-2-0) (DB17-19 methodology)
IC.REG.PRRT.DURS.TM.DRFN                         	Registering property: Time (days) - Score
IC.REG.PRRT.DURS.TM                              	Registering property: Time (days)
IC.REG.PRRT.DFRN.DB1719                          	Registering property (DB17-19 methodology) - Score
IC.REG.PRRT.DFRN.DB16                            	Registering property (DB16 methodology) - Score
IC.REG.PRRT.DFRN.DB0515                          	Registering property (DB05-15 methodology) - Score
IC.REG.PRRT.COST.PRT.VAL.DFRN                    	Registering property: Cost (% of property value) - Score
IC.REG.PRRT.COST.PRT.VAL                         	Registering property: Cost (% of property value)
IC.REG.PROC.MA.NO.DFRN                           	Starting a business: Procedures required - Men (number) - Score
IC.REG.PROC.MA.NO                                	Starting a business: Procedures required - Men (number)
IC.REG.PROC.FE.NO.DFRN                           	Starting a business: Procedures required - Women (number) - Score
IC.REG.PROC.FE.NO                                	Starting a business: Procedures required - Women (number)
IC.REG.MIN.CAP                                   	Starting a business: Minimum capital (% of income per capita)
IC.REG.DURS.MA.DY.DFRN                           	Starting a business: Time - Men (days) - Score
IC.REG.DURS.MA.DY                                	Starting a business: Time - Men (days)
IC.REG.DURS.FE.DY.DRFN                           	Starting a business: Time - Women (days)- Score
IC.REG.DURS.FE.DY                                	Starting a business: Time - Women (days)
IC.REG.DFRN.PC.DFRN                              	Starting a business: Paid-in Minimum capital (% of income per capita) - Score
IC.REG.COST.PC.MA.ZS.DFRN                        	Starting a business: Cost - Men (% of income per capita) - Score
IC.REG.COST.PC.MA.ZS                             	Cost of business start-up procedures, male (% of GNI per capita)
IC.REG.COST.PC.FE.ZS.DRFN                        	Starting a business: Cost - Women (% of income per capita) - Score
IC.REG.COST.PC.FE.ZS                             	Cost of business start-up procedures, female (% of GNI per capita)
IC.ELC.TIME.DFRN                                 	Getting electricity: Time (days) - Score
IC.ELC.TIME                                      	Time required to get electricity (days)
IC.ELC.SAIF.XD.DB1619                            	Getting electricity: System average interruption frequency index (SAIFI) (DB16-19 methodology)
IC.ELC.SAID.XD.DB1619                            	Getting electricity: System average interruption duration index (SAIDI) (DB16-19 methodology)
IC.ELC.RSTT.XD.08.DFRN.DB1619                    	Getting electricity: Reliability of supply and transparency of tariff index (0-8) (DB16-19 methodology) - Score
IC.ELC.RSTT.XD.08.DB1619                         	Getting electricity: Reliability of supply and transparency of tariff index (0-8) (DB16-19 methodology)
IC.ELC.RSTOR.01.DB1619                           	Getting electricity: Mechanisms for restoring service (0-1) (DB16-19 methodology)
IC.ELC.REGU.MONT.01.DB1619                       	Getting electricity: Regulatory monitoring (0-1) (DB16-19 methodology)
IC.ELC.PROC.NO.DFRN                              	Getting electricity: Procedures (number) - Score
IC.ELC.PROC.NO                                   	Getting electricity: Procedures (number)
IC.ELC.PRI.KH.DB1619                             	Getting electricity: Price of electricity (US cents per kWh) (DB16-19 methodology)
IC.ELC.OUTG.MN.DB1619                            	Getting electricity: Minimum outage time (in minutes)  (DB16-19 methodology)
IC.ELC.OUTG.FREQ.DURS.03.DB1619                  	Getting electricity: Total duration and frequency of outages per customer a year (0-3) (DB16-19 methodology)
IC.ELC.MONT.OUTG.01.DB1619                       	Getting electricity: Mechanisms for monitoring outages (0-1) (DB16-19 methodology)
IC.ELC.LMTG.OUTG.01.DB1619                       	Getting electricity: Financial deterrents aimed at limiting outages (0-1) (DB16-19 methodology)
IC.ELC.COMM.TRFF.CG.01.DB1619                    	Getting electricity: Communication of tariffs and tariff changes (0-1) (DB16-19 methodology)
IC.ELC.ACS.COST.DFRN                             	Getting electricity: Cost to get electricity (% of income per capita) - Score
IC.ELC.ACS.COST                                  	Getting electricity: Cost to get electricity (% of income per capita)
IC.ELC.ACES.RK DB19                              	Rank: Getting electricity (1=most business-friendly regulations) (DB19 methodology)
IC.ELC.ACES.DFRN.DB1619                          	Getting electricity (DB16-19 methodology) - Score
IC.ELC.ACES.DFRN.DB1015                          	Getting electricity (DB10-15 methodology) - Score
IC.DCP.BQC.XD.015.DB1619                         	Dealing with construction permits: Building quality control index (0-15) (DB16-19 methodology)
IC.CRED.ACC.PUBL.CRD.REG.COVR.ZS                 	Getting credit: Credit registry coverage (% of adults)
IC.CRED.ACC.PRVT.CRD.ZS                          	Getting credit: Credit bureau coverage (% of adults)
IC.CRED.ACC.LGL.RGHT.XD.012.DB1519               	Getting credit: Strength of legal rights index (0-12) (DB15-19 methodology)
IC.CRED.ACC.LGL.RGHT.XD.010.DB0514               	Getting credit: Strength of legal rights index (0-10) (DB05-14 methodology)
IC.CRED.ACC.LGL.RGHT.012.XD.DB1519.DFRN          	Getting credit: Strength of legal rights index (0-12) (DB15-19 methodology) - Score
IC.CRED.ACC.LGL.RGHT.010.XD.DB0514.DFRN          	Getting credit: Strength of legal rights index (0-10) (DB05-14 methodology) - Score
IC.CRED.ACC.DPTH.CISI.XD.08.DB1519.DFRN          	Getting credit: Depth of credit information index (0-8) (DB15-19 methodology) - Score
IC.CRED.ACC.DPTH.CISI.XD.08.DB1519               	Getting credit: Depth of credit information index (0-8) (DB15-19 methodology)
IC.CRED.ACC.DPTH.CISI.XD.06.DB0514.DFRN          	Getting credit: Depth of credit information index (0-6) (DB05-14 methodology) - Score
IC.CRED.ACC.DPTH.CISI.XD.06.DB0514               	Getting credit: Depth of credit information index (0-6) (DB05-14 methodology)
IC.CRED.ACC.CRD.RK                               	Rank: Getting credit  (DB19 methodology) (1=most business-friendly regulations)
IC.CRED.ACC.CRD.DB1519.DFRN                      	Getting credit (DB15-19 methodology) - Score
IC.CRED.ACC.CRD.DB0514.DFRN                      	Getting credit (DB05-14 methodology) - Score
IC.CRED.ACC.ACES.DB1519                          	Getting Credit total score (DB15-19 methodology)
IC.CRED.ACC.ACES.DB0514                          	Getting Credit total score (DB05-14 methodology)
IC.CNST.PRMT.TM.DY.DFRN                          	Dealing with construction permits: Time (days)  - Score
IC.CNST.PRMT.TM.DY                               	Dealing with construction permits: Time (days)
IC.CNST.PRMT.RK                                  	Rank: Dealing with construction permits  (DB19 methodology) (1=most business-friendly regulations)
IC.CNST.PRMT.QCDC.XD.03.DB1619                   	Dealing with construction permits: Quality control during construction index (0-3) (DB16-19 methodology)
IC.CNST.PRMT.QCBC.XD.01.DB1619                   	Dealing with construction permits: Quality control before construction index (0-1) (DB16-19 methodology)
IC.CNST.PRMT.QCAC.XD.DB1619                      	Dealing with construction permits: Quality control after construction index (0-3) (DB16-19 methodology)
IC.CNST.PRMT.QBR.XD.02.DB1619                    	Dealing with construction permits: Quality of building regulations index (0-2) (DB16-19 methodology)
IC.CNST.PRMT.PROC.NO.DFRN                        	Dealing with construction permits: Procedures (number) - Score
IC.CNST.PRMT.PROC.NO                             	Dealing with construction permits: Procedures (number)
IC.CNST.PRMT.DFRN.DB1619                         	Dealing with construction permits (DB16-19 methodology) - Score
IC.CNST.PRMT.DFRN.DB0615                         	Dealing with construction permits (DB06-15 methodology) - Score
IC.CNST.PRMT.COST.WRH.VAL.DFRN                   	Dealing with construction permits: Cost (% of Warehouse value) - Score
IC.CNST.PRMT.COST.WRH.VAL                        	Dealing with construction permits: Cost (% of Warehouse value)
IC.CNST.PRMT.BQCI.015.DB1619.DFRN                	Dealing with construction permits: Building quality control index (0-15) (DB16-19 methodology) - Score
IC.CNST.PC.XD.04.DB1619                          	Dealing with construction permits: Professional certifications index (0-4) (DB16-19 methodology)
IC.CNST.LIR.XD.02.DB1619                         	Dealing with construction permits: Liability and insurance regimes index (0-2) (DB16-19 methodology)
IC.BUS.EASE.XQ                                   	Ease of doing business index (1=most business-friendly regulations)
IC.BUS.EASE.DFRN.XQ.DB1719                       	Global: Ease of doing business score (DB17-19 methodology)
IC.BUS.EASE.DFRN.DB16                            	Global: Ease of doing business score (DB16 methodology)
IC.BUS.EASE.DFRN.DB15                            	Global: Ease of doing business score (DB15 methodology)
IC.BUS.EASE.DFRN.DB1014                          	Global: Ease of doing business score (DB10-14 methodology)
ENF.CONT.EC.QJPI                                 	Enforcing contracts: Quality of the judicial administration index (0-18) (DB17-19 methodology)
ENF.CONT.DURS.DY.DFRN                            	Enforcing contracts: Time (days) - Score
ENF.CONT.DURS.DY                                 	Enforcing contracts: Time (days)
ENF.CONT.COEN.TRJU.DY                            	Enforcing contracts: Trial and judgment (days)
ENF.CONT.COEN.RK.DB19                            	Rank: Enforcing contracts (1=most business-friendly regulations) (DB19 methodology)
ENF.CONT.COEN.QUJP.XD                            	Enforcing contracts: Quality of the judicial processes index (0-18) (DB16 methodology)
ENF.CONT.COEN.QUJP.DB1719.DFRN                   	Enforcing contracts: Quality of the judicial processes index (0-19) (DB17-19 methodology) - Score
ENF.CONT.COEN.QUJP.DB16.DFRN                     	Enforcing contracts: Quality of the judicial processes index (0-19) (DB16 methodology) - Score
ENF.CONT.COEN.PROC.NO.DFRN                       	Enforcing contracts: Procedures (number) - Score
ENF.CONT.COEN.PROC.NO                            	Enforcing contracts: Procedures (number)
ENF.CONT.COEN.FLSR.DY                            	Enforcing contracts: Filing and service (days)
ENF.CONT.COEN.ENJU.DY                            	Enforcing contracts: Enforcement of judgment (days)
ENF.CONT.COEN.ENFE.PR                            	Enforcing contracts: Enforcement fees (% of claim)
ENF.CONT.COEN.DB1719.DFRN                        	Enforcing contracts (DB17-19 methodology) - Score
ENF.CONT.COEN.DB16.DFRN                          	Enforcing contracts (DB16 methodology) - Score
ENF.CONT.COEN.DB0415.DFRN                        	Enforcing contracts (DB04-15 methodology) - Score
ENF.CONT.COEN.CTSP.DB1719                        	Enforcing contracts: Court structure and proceedings (0-5) (DB17-19 methodology)
ENF.CONT.COEN.CTSP.DB16                          	Enforcing contracts: Court structure and proceedings (0-5) (DB16 methodology)
ENF.CONT.COEN.CTFE.PR                            	Enforcing contracts: Court fees (% of claim)
ENF.CONT.COEN.CTAU                               	Enforcing contracts: Court automation (0-4) (DB16-19 methodology)
ENF.CONT.COEN.CSMG                               	Enforcing contracts: Case management (0-6) (DB16-19 methodology)
ENF.CONT.COEN.COST.ZS.DFRN                       	Enforcing contracts: Cost (% of claim) - Score
ENF.CONT.COEN.COST.ZS                            	Enforcing contracts: Cost (% of claim)
ENF.CONT.COEN.ATFE.PR                            	Enforcing contracts: Attorney fees (% of claim)
ENF.CONT.COEN.ATDR                               	Enforcing contracts: Alternative dispute resolution (0-3) (DB16-19 methodology)

We can search the code of a given country

In [4]:
wbdata.search_countries("tun")
TUN	Tunisia

We need know to extract some data with given dates. We need then to import time library.

In [5]:
import time
from datetime import date
In [6]:
date.today()
Out[6]:
datetime.date(2018, 12, 10)
In [7]:
date(2010, 1, 1)
Out[7]:
datetime.date(2010, 1, 1)
In [8]:
data_date = (date(2010, 1, 1), date(2011, 1, 1))
data_date
Out[8]:
(datetime.date(2010, 1, 1), datetime.date(2011, 1, 1))

We can extract then the GNI per Capita of a the Bahamas.

In [9]:
indicators = {'NY.GNP.PCAP.CD':'GNI per Capita'}
In [10]:
wbdata.get_data(indicator='NY.GNP.PCAP.CD' , country='BHS', data_date=data_date)
Out[10]:
[{'indicator': {'id': 'NY.GNP.PCAP.CD',
   'value': 'GNI per capita, Atlas method (current US$)'},
  'country': {'id': 'BS', 'value': 'Bahamas, The'},
  'value': '21330',
  'decimal': '0',
  'date': '2011'},
 {'indicator': {'id': 'NY.GNP.PCAP.CD',
   'value': 'GNI per capita, Atlas method (current US$)'},
  'country': {'id': 'BS', 'value': 'Bahamas, The'},
  'value': '21660',
  'decimal': '0',
  'date': '2010'}]
In [11]:
wbdata.search_indicators('gdp per capita')
6.0.GDPpc_constant      	GDP per capita, PPP (constant 2011 international $) 
NV.AGR.PCAP.KD.ZG       	Real agricultural GDP per capita growth rate (%)
NY.GDP.PCAP.PP.KD.ZG    	GDP per capita, PPP annual growth (%)
NY.GDP.PCAP.PP.KD       	GDP per capita, PPP (constant 2011 international $)
NY.GDP.PCAP.PP.CD       	GDP per capita, PPP (current international $)
NY.GDP.PCAP.KN          	GDP per capita (constant LCU)
NY.GDP.PCAP.KD.ZG       	GDP per capita growth (annual %)
NY.GDP.PCAP.KD          	GDP per capita (constant 2010 US$)
NY.GDP.PCAP.CN          	GDP per capita (current LCU)
NY.GDP.PCAP.CD          	GDP per capita (current US$)
SE.XPD.TERT.PC.ZS       	Government expenditure per student, tertiary (% of GDP per capita)
SE.XPD.SECO.PC.ZS       	Government expenditure per student, secondary (% of GDP per capita)
SE.XPD.PRIM.PC.ZS       	Government expenditure per student, primary (% of GDP per capita)
UIS.XUNIT.GDPCAP.4.FSGOV	Government expenditure per post-secondary non-tertiary student as % of GDP per capita (%)
UIS.XUNIT.GDPCAP.3.FSGOV	Government expenditure per upper secondary student as % of GDP per capita (%)
UIS.XUNIT.GDPCAP.2.FSGOV	Government expenditure per lower secondary student as % of GDP per capita (%)
In [12]:
data_date = (date(1960, 1, 1), date(2017, 1, 1))
In [13]:
dd=wbdata.get_data(indicator='NY.GDP.PCAP.KD.ZG' , data_date=data_date)
In [14]:
import pandas as pd
In [15]:
dd1=pd.DataFrame(dd)
In [16]:
dd1.head()
Out[16]:
country date decimal indicator value
0 {'id': '1A', 'value': 'Arab World'} 2017 1 {'id': 'NY.GDP.PCAP.KD.ZG', 'value': 'GDP per ... -0.770408386945419
1 {'id': '1A', 'value': 'Arab World'} 2016 1 {'id': 'NY.GDP.PCAP.KD.ZG', 'value': 'GDP per ... 0.939867799846496
2 {'id': '1A', 'value': 'Arab World'} 2015 1 {'id': 'NY.GDP.PCAP.KD.ZG', 'value': 'GDP per ... 1.13528366576823
3 {'id': '1A', 'value': 'Arab World'} 2014 1 {'id': 'NY.GDP.PCAP.KD.ZG', 'value': 'GDP per ... 0.262691673462825
4 {'id': '1A', 'value': 'Arab World'} 2013 1 {'id': 'NY.GDP.PCAP.KD.ZG', 'value': 'GDP per ... 0.866009637832292
In [17]:
dd1.shape
Out[17]:
(15312, 5)

Extract the data concerning only countries

In [18]:
countries = [i['id'] for i in wbdata.get_country(display=False)]

Countries by income level

In [19]:
wbdata.get_incomelevel()
HIC	High income
INX	Not classified
LIC	Low income
LMC	Lower middle income
LMY	Low & middle income
MIC	Middle income
UMC	Upper middle income

High income level and statistics about these countries

In [20]:
countries = [i['id'] for i in wbdata.get_country(incomelevel="HIC", display=False)]
In [21]:
countries[:4]
Out[21]:
['ABW', 'AND', 'ARE', 'ARG']

We consider two indicators

Number of articles published by country

In [22]:
wbdata.search_indicators('scientific')
IP.JRN.ARTC.SC	Scientific and technical journal articles
In [23]:
indicators = {"IP.JRN.ARTC.SC": "scientific_papers", "NY.GDP.PCAP.PP.KD": "gdppc"}
In [24]:
df = wbdata.get_dataframe(indicators, country=countries, convert_date=True,data_date=data_date)
In [25]:
df.describe()
Out[25]:
scientific_papers gdppc
count 854.000000 1612.000000
mean 20617.084309 36565.277051
std 55046.997430 21157.863183
min 0.200000 7855.027176
25% 185.375000 22141.034393
50% 3634.950000 32405.413380
75% 13911.275000 43362.135604
max 440229.700000 135318.754421
In [26]:
df.head()
Out[26]:
scientific_papers gdppc
country date
Aruba 2017-01-01 NaN NaN
2016-01-01 NaN NaN
2015-01-01 NaN NaN
2014-01-01 NaN NaN
2013-01-01 NaN NaN
In [27]:
df.to_csv("wdi_data.csv")
In [28]:
df=pd.read_csv("wdi_data.csv")
In [29]:
df.head()
Out[29]:
country date scientific_papers gdppc
0 Aruba 2017-01-01 NaN NaN
1 Aruba 2016-01-01 NaN NaN
2 Aruba 2015-01-01 NaN NaN
3 Aruba 2014-01-01 NaN NaN
4 Aruba 2013-01-01 NaN NaN
In [30]:
df.date.head()
Out[30]:
0    2017-01-01
1    2016-01-01
2    2015-01-01
3    2014-01-01
4    2013-01-01
Name: date, dtype: object
In [31]:
df['date'] = pd.to_datetime(df['date'])

df['year'] = df['date'].dt.year
In [32]:
df['year'].head()
Out[32]:
0    2017
1    2016
2    2015
3    2014
4    2013
Name: year, dtype: int64
In [33]:
df.groupby('year')[['scientific_papers','gdppc']].corr()
Out[33]:
scientific_papers gdppc
year
1960 scientific_papers NaN NaN
gdppc NaN NaN
1961 scientific_papers NaN NaN
gdppc NaN NaN
1962 scientific_papers NaN NaN
gdppc NaN NaN
1963 scientific_papers NaN NaN
gdppc NaN NaN
1964 scientific_papers NaN NaN
gdppc NaN NaN
1965 scientific_papers NaN NaN
gdppc NaN NaN
1966 scientific_papers NaN NaN
gdppc NaN NaN
1967 scientific_papers NaN NaN
gdppc NaN NaN
1968 scientific_papers NaN NaN
gdppc NaN NaN
1969 scientific_papers NaN NaN
gdppc NaN NaN
1970 scientific_papers NaN NaN
gdppc NaN NaN
1971 scientific_papers NaN NaN
gdppc NaN NaN
1972 scientific_papers NaN NaN
gdppc NaN NaN
1973 scientific_papers NaN NaN
gdppc NaN NaN
1974 scientific_papers NaN NaN
gdppc NaN NaN
... ... ... ...
2003 scientific_papers 1.000000 0.050746
gdppc 0.050746 1.000000
2004 scientific_papers 1.000000 0.045086
gdppc 0.045086 1.000000
2005 scientific_papers 1.000000 0.048119
gdppc 0.048119 1.000000
2006 scientific_papers 1.000000 0.039421
gdppc 0.039421 1.000000
2007 scientific_papers 1.000000 0.034494
gdppc 0.034494 1.000000
2008 scientific_papers 1.000000 0.033696
gdppc 0.033696 1.000000
2009 scientific_papers 1.000000 0.045575
gdppc 0.045575 1.000000
2010 scientific_papers 1.000000 0.052403
gdppc 0.052403 1.000000
2011 scientific_papers 1.000000 0.052468
gdppc 0.052468 1.000000
2012 scientific_papers 1.000000 0.060260
gdppc 0.060260 1.000000
2013 scientific_papers 1.000000 0.065554
gdppc 0.065554 1.000000
2014 scientific_papers 1.000000 0.070679
gdppc 0.070679 1.000000
2015 scientific_papers 1.000000 0.072038
gdppc 0.072038 1.000000
2016 scientific_papers 1.000000 0.074515
gdppc 0.074515 1.000000
2017 scientific_papers NaN NaN
gdppc NaN 1.000000

116 rows × 2 columns

In [34]:
df=df.dropna()
In [35]:
df.shape
Out[35]:
(798, 5)
In [36]:
df.groupby('year')[['scientific_papers','gdppc']].corr()
Out[36]:
scientific_papers gdppc
year
2003 scientific_papers 1.000000 0.050746
gdppc 0.050746 1.000000
2004 scientific_papers 1.000000 0.045086
gdppc 0.045086 1.000000
2005 scientific_papers 1.000000 0.048119
gdppc 0.048119 1.000000
2006 scientific_papers 1.000000 0.039421
gdppc 0.039421 1.000000
2007 scientific_papers 1.000000 0.034494
gdppc 0.034494 1.000000
2008 scientific_papers 1.000000 0.033696
gdppc 0.033696 1.000000
2009 scientific_papers 1.000000 0.045575
gdppc 0.045575 1.000000
2010 scientific_papers 1.000000 0.052403
gdppc 0.052403 1.000000
2011 scientific_papers 1.000000 0.052468
gdppc 0.052468 1.000000
2012 scientific_papers 1.000000 0.060260
gdppc 0.060260 1.000000
2013 scientific_papers 1.000000 0.065554
gdppc 0.065554 1.000000
2014 scientific_papers 1.000000 0.070679
gdppc 0.070679 1.000000
2015 scientific_papers 1.000000 0.072038
gdppc 0.072038 1.000000
2016 scientific_papers 1.000000 0.074515
gdppc 0.074515 1.000000
In [ ]: