Gross national expenditure deflator (base year varies by country)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 5,096 +29.1% 4
Argentina Argentina 78,930 +216% 3
Armenia Armenia 143 +1.76% 48
Australia Australia 105 +4.57% 118
Austria Austria 121 +2.19% 80
Belgium Belgium 120 +1.45% 82
Benin Benin 116 +1.24% 102
Burkina Faso Burkina Faso 123 +4.55% 75
Bangladesh Bangladesh 153 +7.3% 39
Bulgaria Bulgaria 144 +7% 47
Bahamas Bahamas 112 +1.65% 111
Bosnia & Herzegovina Bosnia & Herzegovina 135 +2.69% 53
Belarus Belarus 119 +9.33% 87
Bermuda Bermuda 123 +1.96% 73
Brazil Brazil 253 +3.8% 17
Brunei Brunei 101 +0.154% 120
Botswana Botswana 140 +3.64% 51
Central African Republic Central African Republic 182 -18.2% 25
Canada Canada 118 +3.3% 92
Switzerland Switzerland 106 +1.9% 116
Chile Chile 142 +6.13% 49
Côte d’Ivoire Côte d’Ivoire 113 -2.38% 110
Cameroon Cameroon 121 -0.38% 78
Congo - Kinshasa Congo - Kinshasa 485 +8.19% 8
Colombia Colombia 164 +5.5% 36
Comoros Comoros 119 +2.11% 86
Cape Verde Cape Verde 113 -0.76% 109
Costa Rica Costa Rica 110 -0.711% 113
Cyprus Cyprus 117 +3.66% 95
Czechia Czechia 127 +2.95% 64
Germany Germany 120 +2.65% 84
Djibouti Djibouti 123 +7.97% 74
Denmark Denmark 115 +2.1% 105
Dominican Republic Dominican Republic 140 +4.34% 50
Ecuador Ecuador 108 +1.69% 115
Egypt Egypt 170 +35.9% 35
Spain Spain 118 +2.82% 93
Estonia Estonia 134 +3.02% 57
Ethiopia Ethiopia 428 +22.8% 9
Finland Finland 115 +1.06% 103
France France 114 +1.91% 107
Gabon Gabon 100 +0.593% 121
United Kingdom United Kingdom 117 +2.78% 96
Georgia Georgia 135 +1.86% 55
Ghana Ghana 589 +22.7% 6
Guinea Guinea 231 +2.96% 21
Gambia Gambia 239 +17.8% 19
Guinea-Bissau Guinea-Bissau 128 -2.64% 63
Equatorial Guinea Equatorial Guinea 177 +4.4% 29
Greece Greece 114 +1.83% 108
Guatemala Guatemala 140 +2.44% 52
Honduras Honduras 379 +2.39% 10
Croatia Croatia 127 +4.55% 65
Haiti Haiti 515 +22.4% 7
Hungary Hungary 152 +6.68% 41
Indonesia Indonesia 172 +2.43% 32
India India 179 +3.45% 27
Ireland Ireland 121 +3.98% 79
Iran Iran 1,286 +35.3% 5
Iraq Iraq 199 +5.01% 23
Iceland Iceland 129 +5.44% 62
Israel Israel 118 +4.09% 94
Italy Italy 115 +1.56% 106
Kenya Kenya 155 +5.88% 37
Cambodia Cambodia 118 +4.3% 88
Libya Libya 327 +2.19% 11
Sri Lanka Sri Lanka 243 +2.25% 18
Lithuania Lithuania 146 +1.76% 46
Luxembourg Luxembourg 121 +3.61% 81
Latvia Latvia 124 +2.23% 70
Macao SAR China Macao SAR China 100 +0.165% 122
Morocco Morocco 117 +0.0403% 97
Moldova Moldova 183 +7.84% 24
Madagascar Madagascar 316 +8.59% 12
Mexico Mexico 132 +4.32% 58
North Macedonia North Macedonia 172 +1.52% 31
Mali Mali 112 +2.43% 112
Malta Malta 126 +3.06% 68
Montenegro Montenegro 154 +3.38% 38
Mongolia Mongolia 177 +7.11% 28
Mozambique Mozambique 116 +0.783% 100
Malaysia Malaysia 116 +0.394% 101
Namibia Namibia 134 +2.12% 56
Niger Niger 106 +3.01% 117
Nicaragua Nicaragua 305 +3.47% 14
Netherlands Netherlands 122 +4.17% 77
Norway Norway 119 +3.89% 85
Nepal Nepal 214 +5% 22
Pakistan Pakistan 235 +20.1% 20
Peru Peru 172 +2.08% 33
Philippines Philippines 123 +3.02% 76
Poland Poland 148 +4.16% 44
Portugal Portugal 118 +2.99% 90
Paraguay Paraguay 146 +4.3% 45
Palestinian Territories Palestinian Territories 127 +7.41% 66
Romania Romania 293 +7.21% 15
Russia Russia 179 +9.22% 26
Rwanda Rwanda 149 -1.38% 43
Saudi Arabia Saudi Arabia 103 +2.92% 119
Sudan Sudan 615,642 +247% 2
Senegal Senegal 117 +0.274% 98
Singapore Singapore 118 +2.93% 91
Sierra Leone Sierra Leone 286 +28.6% 16
El Salvador El Salvador 126 +2.29% 67
Somalia Somalia 110 +7.57% 114
Serbia Serbia 130 +4.04% 61
Slovakia Slovakia 131 +3.18% 59
Slovenia Slovenia 125 +2.33% 69
Sweden Sweden 120 +2.82% 83
Seychelles Seychelles 116 +0.547% 99
Chad Chad 115 +1.39% 104
Togo Togo 118 +2.9% 89
Tunisia Tunisia 173 +9.56% 30
Tanzania Tanzania 135 +1.88% 54
Uganda Uganda 124 +1.88% 71
Ukraine Ukraine 307 +10.1% 13
Uruguay Uruguay 172 +5.5% 34
United States United States 123 +2.34% 72
Samoa Samoa 130 +0.119% 60
Kosovo Kosovo 149 +1.01% 42
South Africa South Africa 153 +3.86% 40
Zimbabwe Zimbabwe 676,305 +1,092% 1

                    
# Install missing packages
import sys
import subprocess

def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])

# Required packages
for package in ['wbdata', 'country_converter']:
try:
__import__(package)
except ImportError:
install(package)

# Import libraries
import wbdata
import country_converter as coco
from datetime import datetime

# Define World Bank indicator code
dataset_code = 'NE.DAB.DEFL.ZS'

# Download data from World Bank API
data = wbdata.get_dataframe({dataset_code: 'value'},
date=(datetime(1960, 1, 1), datetime.today()),
parse_dates=True,
keep_levels=True).reset_index()

# Extract year
data['year'] = data['date'].dt.year

# Convert country names to ISO codes using country_converter
cc = coco.CountryConverter()
data['iso2c'] = cc.convert(names=data['country'], to='ISO2', not_found=None)
data['iso3c'] = cc.convert(names=data['country'], to='ISO3', not_found=None)

# Filter out rows where ISO codes could not be matched — likely not real countries
data = data[data['iso2c'].notna() & data['iso3c'].notna()]

# Sort for calculation
data = data.sort_values(['iso3c', 'year'])

# Calculate YoY absolute and percent change
data['value_change'] = data.groupby('iso3c')['value'].diff()
data['value_change_percent'] = data.groupby('iso3c')['value'].pct_change() * 100

# Calculate ranks (higher GDP per capita = better rank)
data['rank'] = data.groupby('year')['value'].rank(ascending=False, method='dense')

# Calculate rank change from previous year
data['rank_change'] = data.groupby('iso3c')['rank'].diff()

# Select desired columns
final_df = data[['country', 'iso2c', 'iso3c', 'year', 'value',
'value_change', 'value_change_percent', 'rank', 'rank_change']].copy()

# Optional: Add labels as metadata (could be useful for export or UI)
column_labels = {
'country': 'Country name',
'iso2c': 'ISO 2-letter country code',
'iso3c': 'ISO 3-letter country code',
'year': 'Year',
'value': 'GDP per capita (current US$)',
'value_change': 'Year-over-Year change in value',
'value_change_percent': 'Year-over-Year percent change in value',
'rank': 'Country rank by GDP per capita (higher = richer)',
'rank_change': 'Change in rank from previous year'
}

# Display first few rows
print(final_df.head(10))

# Optional: Save to CSV
#final_df.to_csv("gdp_per_capita_cleaned.csv", index=False)
                    
                
                    
# Check and install required packages
required_packages <- c("WDI", "countrycode", "dplyr")

for (pkg in required_packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

# Load the necessary libraries
library(WDI)
library(dplyr)
library(countrycode)

# Define the dataset code (World Bank indicator code)
dataset_code <- 'NE.DAB.DEFL.ZS'

# Download data using WDI package
dat <- WDI(indicator = dataset_code)

# Filter only countries using 'is_country' from countrycode
# This uses iso2c to identify whether the entry is a recognized country
dat <- dat %>%
  filter(countrycode(iso2c, origin = 'iso2c', destination = 'country.name', warn = FALSE) %in%
           countrycode::codelist$country.name.en)

# Ensure dataset is ordered by country and year
dat <- dat %>%
  arrange(iso3c, year)

# Rename the dataset_code column to "value" for easier manipulation
dat <- dat %>%
  rename(value = !!dataset_code)

# Calculate year-over-year (YoY) change and percentage change
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(
    value_change = value - lag(value),                              # Absolute change from previous year
    value_change_percent = 100 * (value - lag(value)) / lag(value) # Percent change from previous year
  ) %>%
  ungroup()

# Calculate rank by year (higher value => higher rank)
dat <- dat %>%
  group_by(year) %>%
  mutate(rank = dense_rank(desc(value))) %>% # Rank countries by descending value
  ungroup()

# Calculate rank change (positive = moved up, negative = moved down)
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(rank_change = rank - lag(rank)) %>% # Change in rank compared to previous year
  ungroup()

# Select and reorder final columns
final_data <- dat %>%
  select(
    country,
    iso2c,
    iso3c,
    year,
    value,
    value_change,
    value_change_percent,
    rank,
    rank_change
  )

# Add labels (variable descriptions)
attr(final_data$country, "label") <- "Country name"
attr(final_data$iso2c, "label") <- "ISO 2-letter country code"
attr(final_data$iso3c, "label") <- "ISO 3-letter country code"
attr(final_data$year, "label") <- "Year"
attr(final_data$value, "label") <- "GDP per capita (current US$)"
attr(final_data$value_change, "label") <- "Year-over-Year change in value"
attr(final_data$value_change_percent, "label") <- "Year-over-Year percent change in value"
attr(final_data$rank, "label") <- "Country rank by GDP per capita (higher = richer)"
attr(final_data$rank_change, "label") <- "Change in rank from previous year"

# Print the first few rows of the final dataset
print(head(final_data, 10))