Hours worked in OECD countries

Posted on ven. 30 octobre 2020 in Economics • 2 min read

Hours worked in G7countries


According to OECD, the average number of annual hours worked corresponds to the total number of hours worked divided by the average number of people in employment, for a given annual period.

What is the evolution of the average number of hours worked per week per employee in G7 countries over the years ?

Import required libraries

In [42]:
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 [43]:
df_hours_worked = pd.read_csv('Data/Hours_worked_indicator.csv', 
                              sep=',', 
                              usecols=['COUNTRY', 'Country', 'TIME', 'Value'],
                              parse_dates=True
                             )

#For more meaningful representations, we decide to transform the data in order to go from an annual view to a weekly view
df_hours_worked['Value'] = df_hours_worked['Value'] / 52

df_hours_worked_bar = df_hours_worked.sort_values('Value', ascending=False)

df_hours_worked_bar.head()
Out[43]:
COUNTRY Country TIME Value
1433 CHL Chile 1990 46.576923
1434 CHL Chile 1991 46.519231
1432 CHL Chile 1989 46.461538
1435 CHL Chile 1992 46.442308
1431 CHL Chile 1988 46.365385

Plotting

Bar plot

In [44]:
fig_bar = px.bar(df_hours_worked_bar.query("TIME==2019"), 
             x="Country", 
             y="Value", 
             hover_name="Country", 
             color="Value",
             color_continuous_scale=px.colors.sequential.Teal, 
             labels={'Value':'Hours worked per week', 'Country':''}, 
             title="<b>Average number of weekly hours worked per employee in 2019 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

Let's see the evolution of the average number of hours worked annually per employee for G7 countries over the years.

In [45]:
df_hours_worked_scatter = df_hours_worked.sort_values(by=['TIME', 'COUNTRY'], ascending=True)
             
df_hours_worked_scatter.head()
Out[45]:
COUNTRY Country TIME Value
313 FRA France 1950 45.211538
1035 SWE Sweden 1950 35.076923
1267 USA United States 1950 37.846154
314 FRA France 1951 45.384615
1036 SWE Sweden 1951 34.923077
In [46]:
df_hours_worked_us = df_hours_worked_scatter.query("Country == 'United States'")
df_hours_worked_fr = df_hours_worked_scatter.query("Country == 'France'")
df_hours_worked_ca = df_hours_worked_scatter.query("Country == 'Canada'")
df_hours_worked_de = df_hours_worked_scatter.query("Country == 'Germany'")
df_hours_worked_it = df_hours_worked_scatter.query("Country == 'Italy'")
df_hours_worked_uk = df_hours_worked_scatter.query("Country == 'United Kingdom'")
df_hours_worked_jp = df_hours_worked_scatter.query("Country == 'Japan'")
In [47]:
fig_scatter = go.Figure(data=[
    go.Scatter(
        name='United States',
        x=df_hours_worked_us['TIME'], 
        y=df_hours_worked_us['Value'],
        marker_color=df_hours_worked_us['Value'],
        text=df_hours_worked_us['Country']
    ),
    
    go.Scatter(
        name='France',
        x=df_hours_worked_fr['TIME'], 
        y=df_hours_worked_fr['Value'], 
        marker_color=df_hours_worked_fr['Value'], 
        text=df_hours_worked_fr['Country']
    ),
    
    go.Scatter(
        name='Canada',
        x=df_hours_worked_ca['TIME'], 
        y=df_hours_worked_ca['Value'], 
        marker_color=df_hours_worked_ca['Value'], 
        text=df_hours_worked_ca['Country']
    ),
    
    go.Scatter(
        name='United Kingdom',
        x=df_hours_worked_uk['TIME'], 
        y=df_hours_worked_uk['Value'], 
        marker_color=df_hours_worked_uk['Value'], 
        text=df_hours_worked_uk['Country']
    ),   
    
    go.Scatter(
        name='Germany',
        x=df_hours_worked_de['TIME'], 
        y=df_hours_worked_de['Value'], 
        marker_color=df_hours_worked_de['Value'], 
        text=df_hours_worked_de['Country']
    ), 
    
    go.Scatter(
        name='Italy',
        x=df_hours_worked_it['TIME'], 
        y=df_hours_worked_it['Value'], 
        marker_color=df_hours_worked_it['Value'], 
        text=df_hours_worked_it['Country']
    ),
    
    go.Scatter(
        name='Japan',
        x=df_hours_worked_jp['TIME'], 
        y=df_hours_worked_jp['Value'], 
        marker_color=df_hours_worked_jp['Value'], 
        text=df_hours_worked_jp['Country']
    ),
])


#Style
fig_scatter.update_layout(
    title='<b>Average number of weekly hours worked per employee in G7 countries from 1950 to 2020</b><br>' + 
    '<i>Source : OECD</i>',
    font=dict(
        family='Helvetica',
        size=13,
        color='grey'
    ),
    legend=dict(
        x=0.83,
        y=1,
        bgcolor='rgba(255, 255, 255, 0)',
        bordercolor='rgba(255, 255, 255, 0)'
    ),
    yaxis=dict(
        title='Hours worked per week'
    )
)

fig_scatter.show()

Limitations of the dataset

The data presented are only intended to make comparisons of trends over time. Indeed, due to the disparity of sources and calculation methods specific to each country, it is not possible to compare the average volumes of hours worked for a given year. For example, some countries like the United States or Japan do not have any law clearly defining the limit of weekly working hours and overtime.


Sources

OCDE.Stat data :

  • Hours worked indicator : OECD (2021), Hours worked (indicator). doi: 10.1787/47be1c78-en (Accessed on 17 October 2021)