-
wbdata 5
-
Lecture1.1
-
Lecture1.2
-
Lecture1.3
-
Lecture1.4
-
Lecture1.5
-
-
Hexbin Plots 7
-
Lecture2.1
-
Lecture2.2
-
Lecture2.3
-
Lecture2.4
-
Lecture2.5
-
Lecture2.6
-
Lecture2.7
-
-
Heatmap 5
-
Lecture3.1
-
Lecture3.2
-
Lecture3.3
-
Lecture3.4
-
Lecture3.5
-
-
Boxplot 2
-
Lecture4.1
-
Lecture4.2
-
-
Violin Plot 5
-
Lecture5.1
-
Lecture5.2
-
Lecture5.3
-
Lecture5.4
-
Lecture5.5
-
-
Time Series 2
-
Lecture6.1
-
Lecture6.2
-
-
Pairplot 2
-
Lecture7.1
-
Lecture7.2
-
-
Kernel Density Estimation 3
-
Lecture8.1
-
Lecture8.2
-
Lecture8.3
-
Basics
Let’s first install wbdata.
!pip install wbdata
Now, we can see the different sources available as so:
import wbdata
import pandas as pd
wbdata.get_source()
We import pandas because wbdata returns dataframes. If you have not seen pandas yet, we will be using it for working with the data.
Let’s look into #43, wealth accounting. We can do this by using wbdata.get_indicator().
wbdata.get_indicator(source=43)
To get data, we need to build a dictionary. For this dictionary, they keys represent the indicators in the world bank datasets, and the values represent what you want to refer to the specific data series as.
indicators = {"NY.GDP.PETR.RT.ZS":"Oil Rents"}
NY.GDP.PETR.RT.ZS is the indicator for oil rents, which we were naturally refer to as “Oil Rents”.
It is also possible to search for indicators by name, for example, if we wanted some sort of measure related to GDP, we could use wbdata.search_indicators().
wbdata.search_indicators("gdp")
That’s a lot of results, let’s get a more specific GDP measure.
wbdata.search_indicators("gdp (current")
Let’s add a measure of GDP to our dictionary.
indicators["NY.GDP.MKTP.CD"] = "GDP"
Challenge