Adjusted net savings, excluding particulate emission damage (current US$)

Source: worldbank.org, 03.09.2025

Year: 2021

Flag Country Value Value change, % Rank
Aruba Aruba 214,238,563 -415% 95
Angola Angola 8,716,610,585 +82.7% 51
Albania Albania 593,579,204 -269% 86
Argentina Argentina 56,117,225,678 +88% 28
Armenia Armenia 160,951,312 -54.4% 97
Australia Australia 98,842,152,393 +6.16% 19
Austria Austria 61,650,752,443 +7.74% 27
Azerbaijan Azerbaijan 5,052,143,133 +45.7% 64
Belgium Belgium 72,713,207,250 +30.8% 24
Bangladesh Bangladesh 143,714,117,043 +6.92% 11
Bulgaria Bulgaria 7,239,605,095 +34% 56
Bahamas Bahamas 518,978,393 -35.7% 88
Belarus Belarus 8,753,582,330 +22.2% 50
Belize Belize 296,529,430 -4.63% 93
Bolivia Bolivia -633,496,124 -160% 109
Brazil Brazil -1,270,040,438 -93.2% 114
Brunei Brunei 3,389,928,505 -12% 69
Bhutan Bhutan 331,254,458 -19.3% 92
Botswana Botswana 1,498,430,036 +14.3% 81
Canada Canada 150,337,788,114 +139% 10
Switzerland Switzerland 129,108,861,887 +49.7% 14
Chile Chile -10,760,647,658 -195% 124
China China 2,953,309,412,691 +28.3% 1
Cameroon Cameroon -108,472,346 -13.6% 104
Congo - Kinshasa Congo - Kinshasa -5,281,324,885 -316% 121
Colombia Colombia 5,452,295,547 -59.3% 61
Comoros Comoros 84,206,524 +167% 98
Cape Verde Cape Verde 459,364,500 +4.93% 89
Costa Rica Costa Rica 10,245,905,071 +13.2% 47
Cyprus Cyprus 524,089,045 +83.3% 87
Czechia Czechia 26,333,976,313 +29.7% 36
Germany Germany 643,155,061,831 +21.3% 3
Denmark Denmark 84,332,741,888 +23.7% 22
Dominican Republic Dominican Republic 19,603,719,175 +46.9% 41
Algeria Algeria 25,155,169,768 +24% 37
Ecuador Ecuador 2,779,250,352 -54.9% 71
Egypt Egypt -1,781,279,555 -111% 116
Spain Spain 114,948,163,971 +30.8% 15
Estonia Estonia 6,046,745,512 +36.4% 59
Ethiopia Ethiopia 15,713,992,974 -9.16% 42
Finland Finland 34,026,854,620 +15.1% 33
France France 281,720,402,841 +76.1% 6
Georgia Georgia -889,738,021 +110% 110
Ghana Ghana 3,366,578,223 -67.4% 70
Guinea Guinea -2,044,329,120 +27.3% 117
Gambia Gambia 373,266,440 +148% 91
Greece Greece -4,404,568,729 -66.2% 120
Guatemala Guatemala 7,739,408,352 +16.8% 54
Honduras Honduras 5,227,227,633 +0.441% 63
Croatia Croatia 5,825,650,211 +42.8% 60
Haiti Haiti 2,061,149,458 +4.14% 74
Hungary Hungary 20,595,599,899 +15.3% 40
Indonesia Indonesia 130,719,028,229 +37.1% 12
India India 518,597,451,921 +25.5% 4
Ireland Ireland 77,032,773,201 +69.5% 23
Iraq Iraq 20,629,317,772 +203% 39
Iceland Iceland 1,392,524,461 -15.8% 82
Israel Israel 92,821,153,453 +20% 20
Italy Italy 166,180,777,503 +56% 8
Jamaica Jamaica 4,421,345,972 +40.9% 66
Jordan Jordan 2,016,904,954 -17.4% 75
Japan Japan 185,946,715,862 -26% 7
Kazakhstan Kazakhstan -23,456,475 -100% 103
Kenya Kenya 8,834,066,151 +48.1% 49
Kyrgyzstan Kyrgyzstan -174,985,270 -117% 106
Cambodia Cambodia 4,566,819,760 +7.03% 65
South Korea South Korea 327,120,301,423 +10.9% 5
Lebanon Lebanon -6,087,504,527 +1.24% 122
Lithuania Lithuania 7,793,345,371 +22.8% 52
Luxembourg Luxembourg 12,176,187,813 +56.3% 45
Latvia Latvia 1,253,683,068 -30.7% 83
Morocco Morocco 31,041,072,394 +24.3% 34
Moldova Moldova 971,077,018 +11.8% 85
Madagascar Madagascar -309,426,337 -22.9% 107
Maldives Maldives 1,138,348,304 -6,263% 84
Mexico Mexico 45,093,532,540 -38.5% 31
North Macedonia North Macedonia 1,935,239,515 +36.5% 77
Mongolia Mongolia -968,586,717 +112% 112
Mozambique Mozambique -907,646,018 +123% 111
Mauritania Mauritania 2,478,964,584 +2.91% 72
Mauritius Mauritius 19,396,810 -105% 100
Malaysia Malaysia 1,947,833,128 +80.6% 76
Namibia Namibia -131,963,222 -111% 105
Nigeria Nigeria 87,116,554,017 +25.7% 21
Nicaragua Nicaragua 1,625,565,365 -21.9% 78
Netherlands Netherlands 153,935,546,546 +27.7% 9
Norway Norway 101,765,286,293 +98.7% 18
Nepal Nepal 9,531,545,207 +6.66% 48
New Zealand New Zealand 24,272,029,742 +2.94% 38
Oman Oman -8,390,790,193 +36.9% 123
Pakistan Pakistan 29,055,019,317 +10.2% 35
Panama Panama 11,552,818,709 +19.2% 46
Peru Peru 13,872,116,737 -36.8% 44
Philippines Philippines 34,127,687,822 -35.6% 32
Poland Poland 71,178,691,901 +9.9% 25
Portugal Portugal 7,755,306,635 +116% 53
Paraguay Paraguay 6,851,131,490 +15.6% 58
Qatar Qatar 45,182,286,031 +77.7% 30
Romania Romania 14,315,840,287 -6.88% 43
Russia Russia 113,049,202,091 -9.83% 16
Rwanda Rwanda 58,561,115 -129% 99
Sudan Sudan -2,158,312,422 -142% 118
Singapore Singapore 110,439,660,737 +40.8% 17
El Salvador El Salvador 1,583,154,066 -24.4% 80
Serbia Serbia 3,662,346,884 +17.8% 68
Slovakia Slovakia 5,264,391,938 -0.69% 62
Slovenia Slovenia 6,862,592,050 +10.4% 57
Sweden Sweden 129,222,750,938 +16.2% 13
Eswatini Eswatini 251,239,606 +309% 94
Seychelles Seychelles -18,586,222 -46.3% 102
Thailand Thailand 46,915,879,894 -6.39% 29
Timor-Leste Timor-Leste -1,513,296,386 +179% 115
Tonga Tonga -15,022,357 -119% 101
Tunisia Tunisia -460,197,234 -70.2% 108
Uganda Uganda -1,184,865,032 +7,088% 113
Ukraine Ukraine -3,522,261,612 +198% 119
Uruguay Uruguay 7,600,998,315 +6.79% 55
United States United States 1,032,176,568,888 -16.5% 2
Uzbekistan Uzbekistan 2,241,335,744 -65.5% 73
Vietnam Vietnam 67,279,083,396 +0.323% 26
Vanuatu Vanuatu 391,157,313 -1.46% 90
Samoa Samoa 188,799,642 -20.5% 96
South Africa South Africa 4,005,863,628 -156% 67
Zambia Zambia 1,604,910,961 -61.2% 79

                    
# 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.ADJ.SVNX.CD'

# 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.ADJ.SVNX.CD'

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