df.describe().round(2)
idfloat64
yearfloat64
count
2700
2700
mean
54.5
2002
std
31.18
7.21
min
1
1990
25%
27.75
1996
50%
54.5
2002
75%
81.25
2008
max
108
2014
df1.describe().round(2)
yearfloat64
popfloat64
count
650
650
mean
2002
21.1
std
7.22
17.38
min
1990
2.39
25%
1996
8.62
50%
2002
14.78
75%
2008
30.13
max
2014
89.58
Relationship between capital-labour ratio and total factor productivity in African countries
df1['log_tfp'].describe()
Scatter plot
px.scatter(df1, x = 'kl', y = 'log_tfp', color = 'country', hover_name= 'country')
Histogram - Capital-labour ratio of African countries
px.histogram(df1, x = 'kl', hover_name= 'country', color= 'hi1990', marginal='box')
How has labour productivity contributed to GDP per capita in African countries?
df2 = df1[['country', 'year', 'region', 'pop', 'hi1990','kl', 'GDPpc', 'log_lp', 'log_GDPpc','log_ky', 'log_h', 's', 'log_tfp','isocode']]
df2
countryobject
Algeria3.8%
Benin3.8%
24 others92.3%
yearint64
1990 - 2014
25
Algeria
1990
26
Algeria
1991
27
Algeria
1992
28
Algeria
1993
29
Algeria
1994
30
Algeria
1995
31
Algeria
1996
32
Algeria
1997
33
Algeria
1998
34
Algeria
1999
Scatter plot
px.scatter(df2, #dataframe
x = "log_lp", #x-values column
y = "log_GDPpc", #y-values column
animation_frame = "year", #column animated
animation_group = "country", #column shown as bubble
size = "pop", #column shown by size
color = "country", #column shown by color
hover_name = "country", #hover info title
log_x = True, #use logs on x-values
size_max = 55, #change max size of bubbles
range_x = [6,15], #axis range for x-values
range_y = [3,12] #axis range for y-values
)
fig = px.choropleth(df2, #dataframe
locations = 'isocode', #location code
color = 'GDPpc', #column shown by color
hover_name = 'country', #hover info title
animation_frame = 'year', #column animated
range_color = [3,5000] #color range
)
fig.show()
GDP per capita for African countries in 2014
df2.query("year == 2014")
fig = px.treemap(df2, path=[px.Constant("continent"), 'country'],
color='GDPpc', hover_data=['country'],
color_continuous_scale='emrld')
fig.show()
Labour-productivity for African countries in 2014
df2.query("year == 2014")
fig = px.sunburst(df2, path=['country'], values='pop',
color='log_lp', hover_data=['isocode'],
color_continuous_scale='emrld',
color_continuous_midpoint=np.average(df2['log_lp'], weights=df2['pop']))
fig.show()