A weekly series of quick random charts made in Python 🐍
The chart of this week is a Choropleth map showing the Central Government Debt as a percentage of GDP. That is, the total stock of debt liabilities issued by the central government as a share of GDP. The original map and data source is the IMF website.
What is central government debt?
Central government debt is a measure of a country’s financial position. The amount of government debt today is due to the country’s economic history, to the existence of wars and financial crises and to the way in which demographic developments have gone.
Central government debt also reflects the trade-offs between different long-term economic policy objectives, such as the distribution of prosperity between generations, socio-economic efficiency and fiscal sustainability.
Swedish National Debt Office
Central government debt over the last 20 years
African countries are no longer the ones with the highest debt
🔶 In 1999, the countries with the highest debt were concentrated in the African continent.
Continent | Country | Central Debt as % of GDP in 1999 |
Africa | 🇸🇹São Tomé and Príncipe | 526.18 |
Africa | 🇨🇩Congo, Republic of | 206.32 |
Africa | 🇸🇩Sudan | 160.49 |
Africa | 🇸🇨Seychelles | 159.79 |
Asia | 🇸🇾Syria | 147.67 |
Africa | 🇸🇱Sierra Leone | 146.14 |
Africa | Guinea-Bissau | 145.15 |
Asia | 🇲🇲Myanmar | 144.56 |
Africa | 🇧🇮Burundi | 140.64 |
Africa | 🇦🇴Angola | 137.83 |
🔶 In 2009, there were still 5 African countries in the top 10 but only 2 of them (Guinea-Bissau and Seychelles) belonged to the top 10 in 1999 and remained in this list by 2009.
Continent | Country | Central Debt as % of GDP in 2009 |
Africa | 🇪🇷Eritrea | 206.89 |
Asia | 🇯🇵Japan | 159.85 |
Africa | Guinea-Bissau | 148.26 |
America | 🇯🇲Jamaica | 145.21 |
Africa | 🇱🇧Lebanon | 144.50 |
Europe | 🇬🇷Greece | 125.68 |
Africa | 🇱🇷Liberia | 123.57 |
Europe | 🇮🇹Italy | 109.80 |
Asia | 🇸🇬Singapore | 106.40 |
Africa | 🇸🇨Seychelles | 106.12 |
🔶 By 2019, the top 10 is no longer dominated by African countries. There are the same number of African and European nations in the list and the country with the highest central debt is Japan.
Continent | Country | Central Debt as % of GDP in 2019 |
Asia | 🇯🇵Japan | 201.39 |
Africa | 🇸🇩Sudan | 200.37 |
Europe | 🇬🇷Greece | 189.92 |
Africa | 🇪🇷Eritrea | 189.35 |
Africa | 🇱🇧Lebanon | 174.48 |
Europe | 🇨🇾Cyprus | 135.34 |
Europe | 🇮🇹Italy | 130.59 |
Asia | 🇸🇬Singapore | 129.29 |
Africa | Cabo Verde | 124.98 |
Europe | 🇵🇹Portugal | 120.67 |
🔶 We can see this change clearly when plotting the change in central government debt over the last 20 years. Take a look at this interactive map (made with Plotly). Nations which acquired more debt are in purple tones while nations which managed to decrease their debt are shown in green tones. What patterns do you see?
Python Code
# Author: @QuantGirl
# Title: Central Govermenment Debt as a percentage of GDP
# Data Source: IMF https://www.imf.org/external/datamapper/CG_DEBT_GDP@GDD/CHN/FRA/DEU/ITA/JPN/GBR/USA/SWE/RUS/CAN
# Type: Map
import os.path
import geopandas as gpd
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.colors import ListedColormap
cmap_imf = ListedColormap(['#d48639',
'#436c7c',
'#7eb25b',
'#1c9352',
'#0f724d'])
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world = world[(world.name != "Antarctica")]
imf = pd.read_excel('Data/imf-dm-export-20210930.xls', sheet_name='CG_DEBT_GDP', na_values="no data")
df = pd.merge(world, imf, left_on='name', right_on='Central Government Debt (Percent of GDP)', how='left')
def draw_map(data=df, year=2019):
fig, ax = plt.subplots(figsize=(18, 10), frameon=True, tight_layout=True, facecolor='snow')
data.plot(column=year, ax=ax,
legend=True,
missing_kwds={'color': 'lightgrey'},
cmap=cmap_imf,
scheme='user_defined',
classification_kwds={'bins': [25, 50, 75, 100]})
ax.spines[['top', 'bottom', 'right', 'left']].set_visible(False)
ax.axis('off')
leg = ax.get_legend()
leg.set_bbox_to_anchor((0., 0., 0.2, 0.2))
leg.get_texts()[0].set_text('less than 25%')
leg.get_texts()[1].set_text('25% - 50%')
leg.get_texts()[2].set_text('50% - 75%')
leg.get_texts()[3].set_text('75% - 100%')
leg.get_texts()[4].set_text('100% or more')
leg.get_texts()[5].set_text('no data')
ax.annotate('Central Government Debt',
xy=(0.1, 0.9), xycoords='figure fraction',
horizontalalignment='left', verticalalignment='top',
fontsize=18,
fontname='PT Serif Caption')
ax.annotate('as a Percent of GDP - ' + str(year),
xy=(0.1, 0.86), xycoords='figure fraction',
horizontalalignment='left', verticalalignment='top',
fontsize=16,
fontname='PT Serif Caption')
ax.annotate('Source: IMF',
xy=(0.1, .08), xycoords='figure fraction',
horizontalalignment='left', verticalalignment='top',
fontsize=12, color='#555555')
ax.annotate('@QuantGirl',
xy=(0.9, .08), xycoords='figure fraction',
horizontalalignment='right', verticalalignment='top',
fontsize=16, color='#a70684',
fontname='PT Serif Caption')
plt.subplots_adjust(top=1, bottom=0.0, left=0.05, right=0.95)
plt.show()
return fig
draw_map()