GDP (constant 2015 US$)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 89,594,220,855 +4.42% 67
Albania Albania 15,543,966,722 +3.96% 127
Andorra Andorra 3,362,285,467 +3.37% 159
United Arab Emirates United Arab Emirates 462,404,360,915 +3.76% 29
Argentina Argentina 578,834,679,333 -1.72% 22
Armenia Armenia 16,315,127,652 +5.9% 122
Antigua & Barbuda Antigua & Barbuda 1,731,874,615 +4.33% 168
Australia Australia 1,665,257,959,985 +1.43% 11
Austria Austria 418,190,370,367 -1.17% 33
Azerbaijan Azerbaijan 59,902,281,352 +4.07% 82
Burundi Burundi 3,590,591,567 +3.49% 158
Belgium Belgium 532,530,656,429 +1.02% 24
Benin Benin 19,159,972,711 +7.45% 117
Burkina Faso Burkina Faso 17,989,191,218 +4.99% 119
Bangladesh Bangladesh 336,932,927,922 +4.22% 41
Bulgaria Bulgaria 65,023,138,714 +2.81% 77
Bahrain Bahrain 41,172,709,123 +3.02% 94
Bahamas Bahamas 13,630,935,977 +3.38% 134
Bosnia & Herzegovina Bosnia & Herzegovina 21,194,295,296 +2.48% 113
Belarus Belarus 62,030,020,173 +4.01% 80
Belize Belize 2,762,085,935 +8.15% 160
Bermuda Bermuda 7,605,153,959 +2.11% 149
Bolivia Bolivia 40,047,688,830 +1.38% 95
Brazil Brazil 2,027,676,479,715 +3.4% 9
Barbados Barbados 5,783,409,907 +3.8% 151
Brunei Brunei 13,699,261,291 +4.2% 133
Botswana Botswana 17,489,977,782 -2.99% 120
Central African Republic Central African Republic 2,079,451,881 +1.54% 165
Canada Canada 1,833,284,621,684 +1.53% 10
Switzerland Switzerland 811,109,937,475 +1.3% 19
Chile Chile 288,158,504,435 +2.64% 43
China China 18,488,114,837,769 +4.98% 2
Côte d’Ivoire Côte d’Ivoire 76,346,667,965 +5.95% 71
Cameroon Cameroon 43,143,796,435 +3.67% 93
Congo - Kinshasa Congo - Kinshasa 60,658,948,871 +6.68% 81
Congo - Brazzaville Congo - Brazzaville 10,636,718,190 +2.58% 140
Colombia Colombia 363,510,345,115 +1.74% 40
Comoros Comoros 1,323,426,672 +3.39% 173
Cape Verde Cape Verde 2,349,062,343 +7.27% 161
Costa Rica Costa Rica 76,264,229,554 +4.32% 72
Cyprus Cyprus 31,017,134,702 +3.45% 99
Czechia Czechia 222,480,870,567 +1.12% 50
Germany Germany 3,683,559,545,240 -0.239% 4
Djibouti Djibouti 3,828,825,225 +5.95% 156
Dominica Dominica 607,279,298 +2.05% 179
Denmark Denmark 377,924,893,185 +3.68% 38
Dominican Republic Dominican Republic 104,771,210,812 +4.95% 62
Algeria Algeria 222,243,729,417 +3.3% 51
Ecuador Ecuador 108,801,876,280 -2% 60
Egypt Egypt 482,189,779,213 +2.4% 27
Spain Spain 1,424,805,636,602 +3.15% 13
Estonia Estonia 27,502,872,345 -0.261% 105
Ethiopia Ethiopia 121,005,590,211 +7.32% 58
Finland Finland 252,859,096,868 -0.154% 44
Fiji Fiji 5,504,662,279 +3.83% 152
France France 2,702,385,011,318 +1.17% 7
Micronesia (Federated States of) Micronesia (Federated States of) 332,441,472 +0.719% 180
Gabon Gabon 16,804,782,297 +3.38% 121
United Kingdom United Kingdom 3,271,966,955,942 +1.1% 6
Georgia Georgia 25,129,167,228 +9.43% 108
Ghana Ghana 74,695,964,608 +5.68% 73
Guinea Guinea 15,479,007,958 +5.67% 128
Gambia Gambia 2,076,438,382 +5.75% 166
Guinea-Bissau Guinea-Bissau 1,730,725,641 +4.81% 170
Equatorial Guinea Equatorial Guinea 9,541,952,851 +0.907% 143
Greece Greece 224,962,760,463 +2.27% 49
Grenada Grenada 1,193,683,309 +3.69% 174
Guatemala Guatemala 83,989,978,802 +3.65% 68
Guyana Guyana 27,369,534,584 +43.4% 106
Hong Kong SAR China Hong Kong SAR China 336,511,889,873 +2.54% 42
Honduras Honduras 27,858,556,650 +3.55% 104
Croatia Croatia 68,707,509,494 +3.81% 76
Haiti Haiti 13,595,808,327 -4.17% 135
Hungary Hungary 158,015,487,625 +0.512% 55
Indonesia Indonesia 1,238,236,350,137 +5.03% 16
India India 3,477,476,264,134 +6.48% 5
Ireland Ireland 492,370,629,886 +1.22% 26
Iran Iran 529,138,474,367 +3.04% 25
Iraq Iraq 192,469,260,104 -1.55% 53
Iceland Iceland 23,448,996,816 +0.517% 110
Israel Israel 417,380,424,316 +0.872% 34
Italy Italy 2,029,012,875,282 +0.726% 8
Jamaica Jamaica 15,082,835,198 -0.719% 130
Jordan Jordan 46,405,988,481 +2.49% 90
Japan Japan 4,605,054,526,892 +0.0837% 3
Kazakhstan Kazakhstan 244,025,455,462 +4.8% 45
Kenya Kenya 104,575,203,136 +4.5% 63
Kyrgyzstan Kyrgyzstan 10,050,558,458 +9.04% 141
Cambodia Cambodia 38,515,324,291 +6.02% 96
Kiribati Kiribati 274,669,108 +5.27% 182
St. Kitts & Nevis St. Kitts & Nevis 1,036,489,311 +1.17% 175
Kuwait Kuwait 116,887,023,751 -2.56% 59
Laos Laos 21,168,286,229 +4.26% 114
Liberia Liberia 3,760,763,574 +4.79% 157
Libya Libya 55,429,536,118 -0.606% 85
St. Lucia St. Lucia 2,130,856,443 +3.89% 164
Sri Lanka Sri Lanka 91,751,304,717 +5.01% 65
Lesotho Lesotho 2,314,470,552 +2.76% 163
Lithuania Lithuania 55,144,866,855 +2.77% 87
Luxembourg Luxembourg 70,421,024,000 +1.03% 75
Latvia Latvia 31,570,906,308 -0.442% 98
Macao SAR China Macao SAR China 44,021,751,447 +8.81% 92
Morocco Morocco 134,538,562,551 +3.24% 57
Moldova Moldova 9,252,510,450 +0.103% 144
Madagascar Madagascar 14,492,369,788 +4.2% 132
Maldives Maldives 6,312,995,521 +5.13% 150
Mexico Mexico 1,349,633,274,638 +1.45% 14
Marshall Islands Marshall Islands 218,285,536 +2.77% 183
North Macedonia North Macedonia 12,008,754,399 +2.76% 137
Mali Mali 22,228,532,291 +5% 111
Malta Malta 19,221,900,877 +5.97% 116
Myanmar (Burma) Myanmar (Burma) 63,137,226,235 -0.972% 79
Montenegro Montenegro 5,335,369,922 +3.04% 153
Mongolia Mongolia 16,268,442,809 +4.86% 123
Mozambique Mozambique 20,903,378,791 +1.85% 115
Mauritania Mauritania 8,613,716,581 +5.2% 148
Mauritius Mauritius 14,646,337,855 +4.69% 131
Malawi Malawi 11,964,445,581 +1.83% 138
Malaysia Malaysia 422,011,432,357 +5.11% 32
Namibia Namibia 12,224,610,616 +3.71% 136
Niger Niger 15,814,402,934 +8.42% 126
Nigeria Nigeria 569,515,294,271 +3.43% 23
Nicaragua Nicaragua 15,841,222,425 +3.59% 125
Netherlands Netherlands 926,182,265,714 +0.98% 17
Norway Norway 443,943,701,526 +2.1% 31
Nepal Nepal 34,982,690,898 +3.67% 97
Nauru Nauru 102,254,749 +1.76% 184
New Zealand New Zealand 221,100,836,866 -0.126% 52
Oman Oman 91,453,585,977 +1.67% 66
Pakistan Pakistan 413,006,704,003 +3.23% 35
Panama Panama 77,385,013,513 +2.86% 70
Peru Peru 229,642,617,310 +3.3% 48
Philippines Philippines 454,721,721,977 +5.69% 30
Papua New Guinea Papua New Guinea 27,203,104,310 +4.1% 107
Poland Poland 657,413,741,876 +2.92% 20
Puerto Rico Puerto Rico 99,027,834,181 +3.23% 64
Portugal Portugal 240,564,244,985 +1.93% 46
Paraguay Paraguay 46,015,383,701 +4.25% 91
Palestinian Territories Palestinian Territories 10,959,600,000 -26.6% 139
Qatar Qatar 177,724,600,424 +2.77% 54
Romania Romania 238,241,389,260 +0.814% 47
Russia Russia 1,612,344,875,264 +4.34% 12
Rwanda Rwanda 15,260,942,693 +8.89% 129
Saudi Arabia Saudi Arabia 879,583,643,097 +1.81% 18
Sudan Sudan 29,338,888,295 -13.5% 100
Senegal Senegal 28,192,309,478 +6.89% 103
Singapore Singapore 408,736,675,577 +4.39% 36
Solomon Islands Solomon Islands 1,589,090,837 +2.54% 171
Sierra Leone Sierra Leone 9,800,852,626 +4% 142
El Salvador El Salvador 29,062,047,321 +2.6% 101
Somalia Somalia 8,878,930,663 +3.97% 146
Serbia Serbia 56,488,865,192 +3.88% 84
São Tomé & Príncipe São Tomé & Príncipe 321,609,564 +0.9% 181
Suriname Suriname 4,653,387,372 +2.84% 155
Slovakia Slovakia 107,345,393,746 +2.06% 61
Slovenia Slovenia 55,381,990,841 +1.59% 86
Sweden Sweden 580,446,460,657 +0.974% 21
Eswatini Eswatini 4,763,200,252 +2.64% 154
Sint Maarten Sint Maarten 1,463,023,320 +3.5% 172
Seychelles Seychelles 2,012,826,895 +3.47% 167
Turks & Caicos Islands Turks & Caicos Islands 2,324,730,230 +5.64% 162
Chad Chad 18,622,140,347 +3.65% 118
Togo Togo 8,787,100,467 +5.3% 147
Thailand Thailand 471,105,678,432 +2.53% 28
Tajikistan Tajikistan 15,847,607,944 +8.4% 124
Turkmenistan Turkmenistan 59,349,032,300 +2.26% 83
Timor-Leste Timor-Leste 1,730,956,216 -2.19% 169
Trinidad & Tobago Trinidad & Tobago 22,138,889,024 +1.65% 112
Tunisia Tunisia 48,948,478,710 +1.35% 89
Turkey Turkey 1,295,423,120,852 +3.18% 15
Tanzania Tanzania 74,463,225,268 +5.53% 74
Uganda Uganda 49,356,997,179 +6.14% 88
Ukraine Ukraine 78,535,131,746 +2.91% 69
Uruguay Uruguay 64,204,978,532 +3.11% 78
United States United States 22,679,489,969,556 +2.8% 1
Uzbekistan Uzbekistan 141,462,755,525 +6.5% 56
St. Vincent & Grenadines St. Vincent & Grenadines 953,394,362 +4.06% 177
Vietnam Vietnam 405,742,875,628 +7.09% 37
Vanuatu Vanuatu 883,260,050 +3.97% 178
Samoa Samoa 954,498,941 +9.42% 176
Kosovo Kosovo 8,965,120,678 +4.41% 145
South Africa South Africa 365,414,753,362 +0.58% 39
Zambia Zambia 28,695,824,119 +4.04% 102
Zimbabwe Zimbabwe 23,634,169,921 +2.03% 109

                    
# 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 = 'NY.GDP.MKTP.KD'

# 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 <- 'NY.GDP.MKTP.KD'

# 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))