Working age population in G7 countries

Posted on dim. 01 novembre 2020 in Economics • 2 min read

Working age population in G7 countries


According to OECD, the working age population corresponds to people aged 15 to 64. This indicator measures the share of the working-age population in the total population. What is the evolution of the working age population indicator in G7 countries over the years ?

Import required libraries

In [111]:
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
from IPython.display import Javascript
from plotly.subplots import make_subplots

Javascript(
"""require.config({
 paths: { 
     plotly: 'https://cdn.plot.ly/plotly-latest.min'
 }
});"""
)

pio.renderers.default = 'notebook_connected'

Data pre-processing

In [112]:
df_working_age_pop = pd.read_csv('Data/Working_Age_Population_in_OECD_Countries.csv', 
                              sep=';', 
                              usecols=['LOCATION', 'Country', 'TIME', 'Value'],
                              parse_dates=True
                             )

df_working_age_pop_bar = df_working_age_pop.sort_values('Value', ascending=False)

df_working_age_pop_bar.head()
Out[112]:
LOCATION Country TIME Value
3753 SGP Singapore 2011 73.885367
3754 SGP Singapore 2012 73.679962
3752 SGP Singapore 2010 73.677905
3755 SGP Singapore 2013 73.478647
1127 KOR Korea 2012 73.418329

Plotting

Bar plot

In [113]:
fig_bar = px.bar(df_working_age_pop_bar.query("TIME==2020"), 
             x="Country", 
             y="Value", 
             hover_name="Country", 
             color="Value",
             color_continuous_scale=px.colors.sequential.Oryel, 
             labels={'Value':'Working age population (%)', 'Country':''}, 
             title="<b>Working age population in 2020 in a selection of countries</b><br>" + 
             "<i>Source : OECD</i>"
            )

fig_bar.update_coloraxes(showscale=False)

# Style
fig_bar.update_layout(
    font_family='Helvetica',
    font_color='grey',
    font_size=12,
    title_font_size=20,
    xaxis_tickangle=-45
)

fig_bar.show()

Scatter plot

Now, let's see the evolution of the working age population indicator for G7 countries over the years.

In [114]:
df_working_age_pop_scatter = df_working_age_pop.sort_values(by=['TIME', 'LOCATION'], ascending=True)
             
df_working_age_pop_scatter.head()
Out[114]:
LOCATION Country TIME Value
2840 ARG Argentina 1950 65.267159
0 AUS Australia 1950 65.282991
71 AUT Austria 1950 66.793817
142 BEL Belgium 1950 68.040421
2911 BGR Bulgaria 1950 66.487432
In [115]:
df_working_age_pop_us = df_working_age_pop_scatter.query("Country == 'United States'")
df_working_age_pop_fr = df_working_age_pop_scatter.query("Country == 'France'")
df_working_age_pop_ca = df_working_age_pop_scatter.query("Country == 'Canada'")
df_working_age_pop_de = df_working_age_pop_scatter.query("Country == 'Germany'")
df_working_age_pop_it = df_working_age_pop_scatter.query("Country == 'Italy'")
df_working_age_pop_uk = df_working_age_pop_scatter.query("Country == 'United Kingdom'")
df_working_age_pop_jp = df_working_age_pop_scatter.query("Country == 'Japan'")
In [116]:
fig_scatter = go.Figure(data=[
    go.Scatter(
        name='United States',
        x=df_working_age_pop_us['TIME'], 
        y=df_working_age_pop_us['Value'],
        marker_color=df_working_age_pop_us['Value'],
        text=df_working_age_pop_us['Country']
    ),
    
    go.Scatter(
        name='France',
        x=df_working_age_pop_fr['TIME'], 
        y=df_working_age_pop_fr['Value'], 
        marker_color=df_working_age_pop_fr['Value'], 
        text=df_working_age_pop_fr['Country']
    ),
    
    go.Scatter(
        name='Canada',
        x=df_working_age_pop_ca['TIME'], 
        y=df_working_age_pop_ca['Value'], 
        marker_color=df_working_age_pop_ca['Value'], 
        text=df_working_age_pop_ca['Country']
    ),
    
    go.Scatter(
        name='United Kingdom',
        x=df_working_age_pop_uk['TIME'], 
        y=df_working_age_pop_uk['Value'], 
        marker_color=df_working_age_pop_uk['Value'], 
        text=df_working_age_pop_uk['Country']
    ),   
    
    go.Scatter(
        name='Germany',
        x=df_working_age_pop_de['TIME'], 
        y=df_working_age_pop_de['Value'], 
        marker_color=df_working_age_pop_de['Value'], 
        text=df_working_age_pop_de['Country']
    ), 
    
    go.Scatter(
        name='Italy',
        x=df_working_age_pop_it['TIME'], 
        y=df_working_age_pop_it['Value'], 
        marker_color=df_working_age_pop_it['Value'], 
        text=df_working_age_pop_it['Country']
    ),
    
    go.Scatter(
        name='Japan',
        x=df_working_age_pop_jp['TIME'], 
        y=df_working_age_pop_jp['Value'], 
        marker_color=df_working_age_pop_jp['Value'], 
        text=df_working_age_pop_jp['Country']
    )
])


#Style
fig_scatter.update_layout(
    title='<b>Working age population in G7 countries from 1950 to 2020</b><br>' + 
    '<i>Source : OECD</i>',
    font=dict(
        family='Helvetica',
        size=14,
        color='grey'
    ),
    legend=dict(
        x=1,
        y=1,
        bgcolor='rgba(255, 255, 255, 0)',
        bordercolor='rgba(255, 255, 255, 0)'
    ),
    yaxis=dict(
        title='Working age population (%)'
    )
)

fig_scatter.show()

Sources

OCDE.Stat data :