PPG, other private creditors (NFL, current US$)

Source: worldbank.org, 03.09.2025

Year: 2012

Flag Country Value Value change, % Rank
Angola Angola 921,151,000 +191% 2
Albania Albania 202,000 -84.8% 10
Argentina Argentina -65,896,000 +51.3% 54
Armenia Armenia -4,000 -42.9% 12
Azerbaijan Azerbaijan -15,543,000 +0.988% 42
Burkina Faso Burkina Faso -2,350,000 -6.89% 29
Bangladesh Bangladesh -1,964,000 -57.5% 27
Belarus Belarus -13,030,000 -6.9% 39
Bolivia Bolivia -343,000 +66.5% 18
Brazil Brazil 10,201,783,000 -67,155% 1
Botswana Botswana -750,000 +200% 22
Central African Republic Central African Republic -117,000 -23% 16
China China -724,734,000 -81.8% 63
Côte d’Ivoire Côte d’Ivoire 2,418,000 -90.4% 9
Congo - Kinshasa Congo - Kinshasa 12,639,000 -353% 6
Congo - Brazzaville Congo - Brazzaville 38,729,000 +13.8% 4
Colombia Colombia -14,394,000 -10.1% 41
Cape Verde Cape Verde -437,000 -79.1% 19
Costa Rica Costa Rica -443,000 -101% 20
Djibouti Djibouti -991,000 -6.86% 24
Dominica Dominica -61,000 -106% 14
Dominican Republic Dominican Republic -17,982,000 +53.4% 44
Algeria Algeria -67,728,000 -46% 55
Ecuador Ecuador -6,998,000 -12.6% 36
Egypt Egypt -21,929,000 +0.583% 47
Ethiopia Ethiopia -48,901,000 +18.3% 51
Gabon Gabon -33,892,000 -229% 50
Georgia Georgia 151,530,000 -26.2% 3
Ghana Ghana -18,948,000 -17.5% 45
Indonesia Indonesia -251,305,000 +3.43% 61
India India -211,030,000 +701% 59
Iran Iran -125,439,000 -68.3% 57
Jamaica Jamaica -7,671,000 +27.3% 38
Jordan Jordan -13,039,000 +11.7% 40
Kenya Kenya -2,227,000 -44.1% 28
Lebanon Lebanon 5,072,000 -213% 8
Sri Lanka Sri Lanka 14,403,000 -41.2% 5
Lesotho Lesotho -93,000 -7.92% 15
Morocco Morocco -31,700,000 -15.4% 49
Moldova Moldova -5,295,000 -341% 35
Mexico Mexico -325,176,000 +20.3% 62
North Macedonia North Macedonia -3,234,000 -207% 31
Myanmar (Burma) Myanmar (Burma) 7,250,000 -252% 7
Montenegro Montenegro -896,000 -20.4% 23
Mongolia Mongolia -3,501,000 -174% 33
Mauritius Mauritius -4,562,000 -6.69% 34
Nepal Nepal -501,000 -2.91% 21
Peru Peru -1,228,000 -59.5% 25
Philippines Philippines -63,152,000 -27.2% 53
Papua New Guinea Papua New Guinea -7,671,000 -2.74% 38
El Salvador El Salvador -28,000 -69.2% 13
Serbia Serbia -71,743,000 +0.00558% 56
Chad Chad -1,875,000 -62.5% 26
Thailand Thailand -20,578,000 -52.4% 46
Tonga Tonga -198,000 +148% 17
Tunisia Tunisia -15,962,000 -0.937% 43
Turkey Turkey -148,697,000 +66.4% 58
Ukraine Ukraine -3,397,000 -6.88% 32
Uzbekistan Uzbekistan -52,272,000 +7.04% 52
St. Vincent & Grenadines St. Vincent & Grenadines -3,010,000 -0.0664% 30
Vietnam Vietnam -23,757,000 -19.5% 48
South Africa South Africa -249,000,000 +243% 60
Zambia Zambia -7,248,000 +76.3% 37
Zimbabwe Zimbabwe 17,000 -99.1% 11

                    
# 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 = 'DT.NFL.PROP.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 <- 'DT.NFL.PROP.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))