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

Source: worldbank.org, 03.09.2025

Year: 2021

Flag Country Value Value change, % Rank
Angola Angola 8,320,525,005 +87.9% 50
Albania Albania 553,167,293 -243% 84
Argentina Argentina 55,440,253,035 +89.5% 28
Armenia Armenia 122,216,022 -61.3% 92
Australia Australia 98,542,134,250 +6.14% 19
Austria Austria 61,451,135,844 +7.74% 27
Azerbaijan Azerbaijan 4,963,248,726 +46.4% 63
Belgium Belgium 72,443,926,524 +30.9% 24
Bangladesh Bangladesh 141,020,395,858 +6.97% 11
Bulgaria Bulgaria 6,984,287,174 +35% 56
Bahamas Bahamas 504,495,498 -36.3% 85
Belarus Belarus 8,632,809,827 +22.4% 49
Belize Belize 289,503,293 -4.86% 90
Bolivia Bolivia -804,284,610 -191% 103
Brazil Brazil -3,856,128,149 -81.7% 111
Brunei Brunei 3,381,548,819 -12.1% 68
Bhutan Bhutan 318,267,842 -20.1% 89
Botswana Botswana 1,416,495,009 +14.8% 78
Canada Canada 149,729,878,001 +140% 10
Switzerland Switzerland 128,794,473,946 +49.9% 13
Chile Chile -11,166,411,849 -202% 118
China China 2,869,513,259,074 +28.7% 1
Cameroon Cameroon -712,900,502 +3.19% 102
Congo - Kinshasa Congo - Kinshasa -5,816,540,450 -401% 115
Colombia Colombia 4,962,486,318 -61.6% 64
Comoros Comoros 70,488,305 +297% 93
Cape Verde Cape Verde 450,967,278 +4.92% 87
Costa Rica Costa Rica 10,175,339,332 +13.3% 47
Cyprus Cyprus 499,245,829 +89.2% 86
Czechia Czechia 26,058,467,684 +29.9% 35
Germany Germany 640,457,810,538 +21.3% 3
Denmark Denmark 84,171,268,954 +23.7% 21
Dominican Republic Dominican Republic 19,318,412,579 +47.7% 41
Algeria Algeria 24,564,420,029 +24.4% 36
Ecuador Ecuador 2,462,753,214 -58% 70
Egypt Egypt -4,424,324,891 -133% 113
Spain Spain 114,465,576,138 +30.9% 15
Estonia Estonia 6,034,969,103 +36.4% 59
Ethiopia Ethiopia 14,881,959,222 -9.45% 42
Finland Finland 33,987,744,031 +15.1% 32
France France 280,559,707,667 +76.6% 6
Georgia Georgia -977,664,431 +94.1% 104
Ghana Ghana 2,855,656,831 -70.9% 69
Guinea Guinea -2,315,136,540 +25.5% 109
Gambia Gambia 354,541,658 +166% 88
Greece Greece -4,630,730,756 -65% 114
Guatemala Guatemala 7,233,913,608 +17.9% 55
Honduras Honduras 5,066,634,444 +0.242% 62
Croatia Croatia 5,755,755,647 +43.4% 60
Haiti Haiti 1,673,357,788 -2.08% 75
Hungary Hungary 20,313,637,054 +15.5% 39
Indonesia Indonesia 124,414,978,771 +38.9% 14
India India 481,823,752,516 +26.8% 4
Ireland Ireland 76,960,863,662 +69.6% 23
Iraq Iraq 19,438,360,678 +240% 40
Iceland Iceland 1,388,625,441 -15.8% 79
Israel Israel 92,399,010,034 +20.1% 20
Italy Italy 164,893,883,310 +56.6% 8
Jamaica Jamaica 4,386,432,881 +41.4% 66
Jordan Jordan 1,897,339,352 -18.4% 72
Japan Japan 182,142,111,391 -26.3% 7
Kazakhstan Kazakhstan -353,931,738 -103% 99
Kenya Kenya 7,775,214,600 +57.5% 51
Kyrgyzstan Kyrgyzstan -208,264,386 -121% 97
Cambodia Cambodia 4,432,402,821 +7.25% 65
South Korea South Korea 324,361,729,778 +10.9% 5
Lebanon Lebanon -6,205,049,882 +0.704% 116
Lithuania Lithuania 7,733,456,489 +22.9% 52
Luxembourg Luxembourg 12,155,827,386 +56.4% 45
Latvia Latvia 1,202,362,050 -31.9% 81
Morocco Morocco 30,271,819,348 +24.7% 34
Moldova Moldova 942,611,233 +12% 83
Madagascar Madagascar -462,080,479 -15.8% 100
Maldives Maldives 1,133,236,257 -4,890% 82
Mexico Mexico 42,771,702,188 -39.9% 31
North Macedonia North Macedonia 1,894,957,138 +37.4% 73
Mongolia Mongolia -1,055,074,300 +97.8% 105
Mozambique Mozambique -1,077,766,312 +91.7% 106
Mauritania Mauritania 2,389,947,924 +2.56% 71
Mauritius Mauritius 426,068 -100% 94
Malaysia Malaysia 1,305,491,783 +160% 80
Namibia Namibia -221,468,322 -120% 98
Nigeria Nigeria 78,246,107,145 +30.5% 22
Nicaragua Nicaragua 1,581,334,350 -22.4% 76
Netherlands Netherlands 153,420,580,060 +27.8% 9
Norway Norway 101,702,192,983 +98.8% 18
Nepal Nepal 8,910,417,207 +6.7% 48
New Zealand New Zealand 24,220,455,210 +2.91% 37
Oman Oman -8,485,653,800 +36.5% 117
Pakistan Pakistan 21,067,066,972 +10.6% 38
Panama Panama 11,505,770,298 +19.3% 46
Peru Peru 13,432,332,035 -37.5% 44
Philippines Philippines 31,367,196,049 -37.7% 33
Poland Poland 70,142,646,132 +9.93% 25
Portugal Portugal 7,659,969,086 +119% 53
Paraguay Paraguay 6,765,949,849 +15.8% 58
Qatar Qatar 45,068,213,269 +77.8% 29
Romania Romania 13,828,432,030 -7.44% 43
Russia Russia 110,591,090,909 -10.3% 16
Rwanda Rwanda -162,439,441 -61.3% 96
Sudan Sudan -2,803,121,070 -161% 110
Singapore Singapore 110,166,542,088 +41% 17
El Salvador El Salvador 1,516,862,525 -25.3% 77
Serbia Serbia 3,431,658,318 +18.4% 67
Slovakia Slovakia 5,117,325,818 -0.921% 61
Slovenia Slovenia 6,827,914,778 +10.4% 57
Sweden Sweden 129,163,475,323 +16.2% 12
Eswatini Eswatini 203,759,718 +1,029% 91
Thailand Thailand 45,056,028,268 -6.67% 30
Timor-Leste Timor-Leste -1,541,196,419 +176% 107
Tonga Tonga -16,579,238 -122% 95
Tunisia Tunisia -611,838,362 -63.8% 101
Uganda Uganda -1,548,069,261 +305% 108
Ukraine Ukraine -3,951,544,498 +159% 112
Uruguay Uruguay 7,562,679,862 +6.8% 54
United States United States 1,016,630,476,921 -16.8% 2
Uzbekistan Uzbekistan 1,889,277,542 -69.4% 74
Vietnam Vietnam 66,129,471,038 +0.219% 26

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