Commercial banks and other lending (PPG + PNG) (NFL, current US$)

Source: worldbank.org, 03.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Angola Angola -3,782,837,000 -33.9% 85
Albania Albania 253,336,000 +376% 30
Argentina Argentina 983,814,000 -390% 15
Armenia Armenia 205,389,000 +179% 32
Azerbaijan Azerbaijan -502,858,000 +21.4% 79
Benin Benin 594,478,000 +128% 20
Burkina Faso Burkina Faso -37,237,000 -91.8% 59
Bangladesh Bangladesh 1,235,431,000 +287% 14
Bosnia & Herzegovina Bosnia & Herzegovina 467,324,000 +1,904% 25
Belarus Belarus -1,688,028,000 +126% 82
Belize Belize -4,301,000 +80% 53
Bolivia Bolivia -87,929,000 -84% 66
Brazil Brazil 11,460,219,000 -65.1% 2
Bhutan Bhutan -4,246,000 +2.63% 52
China China -9,927,394,000 -52.4% 87
Côte d’Ivoire Côte d’Ivoire 281,002,000 -86.5% 29
Cameroon Cameroon -179,244,000 +183% 71
Congo - Kinshasa Congo - Kinshasa 3,472,000 -115% 45
Congo - Brazzaville Congo - Brazzaville -208,407,000 -34.9% 72
Colombia Colombia 6,575,952,000 -26.8% 3
Cape Verde Cape Verde -27,701,000 +170% 58
Costa Rica Costa Rica 479,585,000 -36.6% 23
Dominica Dominica -5,029,000 +14.6% 54
Dominican Republic Dominican Republic 582,082,000 +27.1% 22
Ecuador Ecuador 640,590,000 -599% 19
Egypt Egypt 3,517,179,000 +31.1% 8
Ethiopia Ethiopia 105,841,000 -117% 35
Gabon Gabon 473,396,000 -867% 24
Georgia Georgia 349,254,000 -29.8% 26
Ghana Ghana 712,161,000 -170% 17
Guinea Guinea 163,184,000 -29.9% 33
Gambia Gambia -3,358,000 -18% 51
Grenada Grenada 0 47
Guatemala Guatemala -65,262,000 -96.6% 62
Guyana Guyana 666,531,000 +2,875% 18
Honduras Honduras -109,104,000 -40.2% 67
Haiti Haiti -659,000 -63.8% 49
Indonesia Indonesia 44,428,000 -99.1% 39
India India 27,712,780,000 -423% 1
Iran Iran 544,000 -98.8% 46
Iraq Iraq -497,027,000 +33.9% 78
Jordan Jordan 13,229,000 -103% 42
Kenya Kenya 48,863,000 -134% 38
Laos Laos 1,667,881,000 -482% 13
Lebanon Lebanon -2,292,385,000 -9.06% 84
Liberia Liberia 39,701,000 40
Sri Lanka Sri Lanka 954,328,000 +185% 16
Lesotho Lesotho -48,949,000 +411% 60
Morocco Morocco -253,857,000 -22.4% 74
Moldova Moldova -1,694,000 -103% 50
Madagascar Madagascar 8,116,000 -132% 43
Maldives Maldives -7,464,000 -108% 55
Mexico Mexico -5,511,859,000 +181% 86
North Macedonia North Macedonia 291,875,000 -14.3% 28
Myanmar (Burma) Myanmar (Burma) -114,361,000 +346% 68
Montenegro Montenegro -71,526,000 -84.8% 64
Mongolia Mongolia 1,992,539,000 +12.7% 11
Mozambique Mozambique 2,310,240,000 -27.2% 10
Mauritius Mauritius -229,692,000 -113% 73
Niger Niger -7,728,000 +2.64% 56
Nigeria Nigeria -1,354,421,000 -184% 81
Nicaragua Nicaragua 5,158,000 -111% 44
Nepal Nepal -73,505,000 -170% 65
Pakistan Pakistan -406,746,000 -84.8% 76
Philippines Philippines 3,967,923,000 +357% 7
Papua New Guinea Papua New Guinea -1,795,617,000 -1.77% 83
Rwanda Rwanda 588,020,000 +132% 21
Sudan Sudan 0 47
Senegal Senegal 4,607,446,000 +110% 6
El Salvador El Salvador -121,869,000 -128% 69
Serbia Serbia 2,637,655,000 +198% 9
Suriname Suriname -300,811,000 +358% 75
Eswatini Eswatini -56,526,000 +108% 61
Syria Syria 0 47
Togo Togo 23,952,000 -617% 41
Tajikistan Tajikistan 72,297,000 +75.7% 37
Turkmenistan Turkmenistan -66,654,000 +3,329% 63
Tunisia Tunisia -439,364,000 -6.43% 77
Turkey Turkey 5,443,847,000 +357% 5
Tanzania Tanzania 1,695,699,000 +936% 12
Uganda Uganda -740,847,000 -263% 80
Ukraine Ukraine 297,542,000 -110% 27
Uzbekistan Uzbekistan 5,983,286,000 +85.6% 4
St. Vincent & Grenadines St. Vincent & Grenadines -652,000 -61.4% 48
Vietnam Vietnam 125,538,000 -97.9% 34
Kosovo Kosovo 238,359,000 +12.1% 31
South Africa South Africa 103,968,000 -94.3% 36
Zambia Zambia -153,896,000 -74.4% 70
Zimbabwe Zimbabwe -25,419,000 -89.9% 57

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