IFC, private nonguaranteed (NFL, US$)

Source: worldbank.org, 03.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 0 -100% 49
Angola Angola -38,888,889 +250% 76
Albania Albania 31,783,088 -937% 25
Argentina Argentina -139,947,844 -14.7% 85
Armenia Armenia -5,289,207 -85.8% 62
Azerbaijan Azerbaijan 20,000,000 34
Burundi Burundi -1,250,000 -140% 54
Benin Benin 0 49
Burkina Faso Burkina Faso 11,463,746 +72.9% 41
Bangladesh Bangladesh 42,541,191 -183% 23
Bosnia & Herzegovina Bosnia & Herzegovina -249,588 -83.4% 50
Belarus Belarus -8,000,000 -86.3% 64
Belize Belize 0 49
Bolivia Bolivia 0 -100% 49
Brazil Brazil 1,106,842,805 -21.4% 1
Bhutan Bhutan 0 49
Botswana Botswana 0 -100% 49
Central African Republic Central African Republic 0 49
China China 5,840,007 -97.2% 45
Côte d’Ivoire Côte d’Ivoire 75,264,544 +104% 15
Cameroon Cameroon 31,174,266 +94.3% 26
Congo - Kinshasa Congo - Kinshasa 73,000,000 +4,686% 17
Congo - Brazzaville Congo - Brazzaville 9,852,117 44
Colombia Colombia 273,707,597 -51.2% 6
Comoros Comoros -3,562,463 -255% 59
Cape Verde Cape Verde 24,916,475 -3,641% 31
Costa Rica Costa Rica -44,766,259 +21% 80
Djibouti Djibouti 0 49
Dominica Dominica 0 49
Dominican Republic Dominican Republic 51,641,448 -214% 21
Algeria Algeria 0 49
Ecuador Ecuador 19,179,372 -85.8% 35
Egypt Egypt 178,354,698 -694% 7
Eritrea Eritrea 0 49
Ethiopia Ethiopia 75,000,000 +477% 16
Fiji Fiji 0 49
Gabon Gabon 21,515,860 +120% 33
Georgia Georgia -56,346,361 +484% 81
Ghana Ghana -64,113,271 -21.3% 84
Guinea Guinea -23,146,187 -10.7% 71
Gambia Gambia -306,507 +94.7% 51
Guinea-Bissau Guinea-Bissau 0 49
Grenada Grenada 0 49
Guatemala Guatemala 159,500,362 +40.9% 8
Guyana Guyana 0 49
Honduras Honduras -4,698,556 -108% 61
Haiti Haiti -1,910,167 -60.5% 56
Indonesia Indonesia 133,866,800 -56.5% 10
India India 151,753,805 -64% 9
Iran Iran 0 49
Iraq Iraq -39,240,953 -159% 77
Jamaica Jamaica -40,000,000 78
Jordan Jordan -38,027,637 +2.18% 75
Kazakhstan Kazakhstan 91,562,079 +1.17% 13
Kenya Kenya 13,481,912 -88% 38
Kyrgyzstan Kyrgyzstan 17,496,788 +160% 36
Cambodia Cambodia -19,996,718 -169% 70
Laos Laos 12,457,935 -3,165% 40
Lebanon Lebanon 0 49
Liberia Liberia 0 -100% 49
St. Lucia St. Lucia 0 49
Sri Lanka Sri Lanka -36,674,818 -133% 74
Lesotho Lesotho 0 49
Morocco Morocco 123,610,259 +603% 11
Moldova Moldova 10,489,394 43
Madagascar Madagascar 25,558,385 +255% 29
Maldives Maldives -1,363,648 -200% 55
Mexico Mexico 23,724,077 -159% 32
North Macedonia North Macedonia 0 49
Mali Mali 769,345 -255% 47
Myanmar (Burma) Myanmar (Burma) -56,432,059 +90.5% 82
Montenegro Montenegro -2,483,784 -15% 58
Mongolia Mongolia 79,331,734 -328% 14
Mozambique Mozambique 26,254,989 -360% 28
Mauritania Mauritania -63,066,667 +663% 83
Mauritius Mauritius -8,333,333 -0.00001% 65
Malawi Malawi -600,000 +50% 53
Niger Niger 24,925,803 30
Nigeria Nigeria 51,303,773 +1,334% 22
Nicaragua Nicaragua -28,399,182 -23.3% 73
Nepal Nepal 11,000,000 -33.9% 42
Pakistan Pakistan -43,693,664 -21.1% 79
Peru Peru 68,350,419 -56.3% 18
Philippines Philippines 99,381,917 -47.8% 12
Papua New Guinea Papua New Guinea 0 49
Paraguay Paraguay 16,666,667 +150% 37
Rwanda Rwanda -4,229,187 -65% 60
Sudan Sudan 0 49
Senegal Senegal 41,664,336 -72.8% 24
Solomon Islands Solomon Islands 0 49
Sierra Leone Sierra Leone 0 -100% 49
El Salvador El Salvador -18,706,369 -208% 69
Somalia Somalia 0 49
Serbia Serbia 62,404,018 -321% 19
São Tomé & Príncipe São Tomé & Príncipe 0 49
Suriname Suriname 0 49
Eswatini Eswatini 0 49
Syria Syria 0 49
Chad Chad -5,723,237 +80.3% 63
Togo Togo -9,651,769 -39.9% 66
Thailand Thailand 445,281,744 +1.36% 4
Tajikistan Tajikistan -2,242,406 -117% 57
Turkmenistan Turkmenistan 0 49
Timor-Leste Timor-Leste -437,500 52
Tonga Tonga 0 49
Tunisia Tunisia 429,284 -54.1% 48
Turkey Turkey 790,753,241 +142% 2
Tanzania Tanzania 30,468,881 -58.3% 27
Uganda Uganda -25,611,907 -7.34% 72
Ukraine Ukraine -15,147,612 -124% 67
Uzbekistan Uzbekistan 58,697,003 +14% 20
St. Vincent & Grenadines St. Vincent & Grenadines 0 49
Vietnam Vietnam 379,518,427 +158% 5
Vanuatu Vanuatu 0 49
Samoa Samoa 0 49
Kosovo Kosovo 13,251,644 +5,098% 39
Yemen Yemen -18,320,984 +58.3% 68
South Africa South Africa 538,883,426 +328% 3
Zambia Zambia 3,828,101 -86.8% 46
Zimbabwe Zimbabwe 0 49

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