Net financial flows, RDB nonconcessional (NFL, current US$)

Source: worldbank.org, 03.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Angola Angola -37,396,064 -3.71% 68
Albania Albania -24,019,522 -186% 65
Argentina Argentina 864,366,000 -43.7% 5
Armenia Armenia 14,888,265 -86.9% 46
Azerbaijan Azerbaijan -128,387,120 -12.8% 79
Benin Benin 16,192,688 -44.4% 45
Burkina Faso Burkina Faso 3,739,340 -56.3% 52
Bangladesh Bangladesh 1,062,259,000 +38.4% 4
Bosnia & Herzegovina Bosnia & Herzegovina 96,701,259 +561% 29
Belarus Belarus 45,414,139 -72.2% 39
Belize Belize -6,626,000 -228% 61
Bolivia Bolivia 310,789,000 +214% 14
Brazil Brazil 237,584,000 -177% 16
Bhutan Bhutan 6,821,000 -26.9% 50
Botswana Botswana -109,621,480 -459% 78
China China -17,223,000 -107% 64
Côte d’Ivoire Côte d’Ivoire 146,894,811 -43.8% 24
Cameroon Cameroon 94,145,177 -36.5% 30
Congo - Kinshasa Congo - Kinshasa -43,355,261 -50.6% 70
Congo - Brazzaville Congo - Brazzaville 101,514,464 +1,900% 27
Colombia Colombia 647,979,000 +126% 6
Cape Verde Cape Verde -9,155,579 -142% 63
Costa Rica Costa Rica 49,796,000 -84.2% 38
Dominican Republic Dominican Republic 235,417,000 -1,987% 17
Algeria Algeria -64,840,121 +3.8% 73
Ecuador Ecuador 373,686,000 -28.6% 11
Egypt Egypt 441,143,002 +120,326% 8
Ethiopia Ethiopia -74,810,804 +2,905% 75
Fiji Fiji -3,493,000 -103% 59
Gabon Gabon -29,719,945 -183% 67
Georgia Georgia 217,150,965 -35.3% 20
Ghana Ghana -1,458,116 +20.4% 58
Guatemala Guatemala -53,229,000 -32.5% 72
Guyana Guyana 59,213,000 -62% 35
Honduras Honduras 34,059,000 -90.2% 42
Haiti Haiti -500,000 -200% 55
Indonesia Indonesia 1,336,909,000 +104% 2
India India 1,239,432,000 -51.4% 3
Jamaica Jamaica -96,497,000 -569% 77
Jordan Jordan -26,203,422 +123% 66
Kazakhstan Kazakhstan -51,889,964 -173% 71
Kenya Kenya 230,044,755 -28.4% 19
Kyrgyzstan Kyrgyzstan 13,489,857 +140% 47
Laos Laos -617,000 +10.2% 56
Sri Lanka Sri Lanka 497,154,000 -22.3% 7
Morocco Morocco 100,446,774 -76.9% 28
Moldova Moldova -42,279,177 -119% 69
Mexico Mexico -525,939,000 -305% 81
North Macedonia North Macedonia 77,345,869 +318% 33
Montenegro Montenegro -6,745,191 -242% 62
Mongolia Mongolia 144,059,000 -15.7% 25
Mauritania Mauritania -1,115,265 -1.02% 57
Mauritius Mauritius 231,390,810 -1,304% 18
Nigeria Nigeria 58,205,895 -849% 36
Nicaragua Nicaragua 1,951,000 -95.5% 53
Pakistan Pakistan 394,981,000 -72.7% 9
Peru Peru 315,127,000 -36.6% 13
Philippines Philippines 1,461,175,000 -9.98% 1
Papua New Guinea Papua New Guinea 9,295,000 -96.9% 49
Paraguay Paraguay 190,646,000 -70.8% 21
Rwanda Rwanda 45,006,813 +198% 40
Sudan Sudan 0 54
Senegal Senegal 265,039,530 +95.3% 15
El Salvador El Salvador 31,216,000 -37.7% 43
Somalia Somalia 0 54
Serbia Serbia 141,480,332 -2,951% 26
Suriname Suriname 155,846,000 -15.6% 23
Eswatini Eswatini 9,681,194 -87.6% 48
Thailand Thailand -330,571,000 +704% 80
Tajikistan Tajikistan 52,067,337 -10.3% 37
Turkmenistan Turkmenistan 90,930,000 -45.3% 32
Timor-Leste Timor-Leste 5,419,000 -11.4% 51
Tunisia Tunisia -76,526,026 +28.1% 76
Turkey Turkey 35,820,084 -60.8% 41
Tanzania Tanzania 163,019,462 +53.1% 22
Uganda Uganda 63,856,927 -3.18% 34
Ukraine Ukraine 322,381,863 +186% 12
Uzbekistan Uzbekistan 388,047,000 -40.5% 10
Vietnam Vietnam -71,396,000 +272% 74
Kosovo Kosovo -5,249,744 -215% 60
South Africa South Africa 92,588,341 -157% 31
Zambia Zambia 17,219,906 -67.1% 44
Zimbabwe Zimbabwe 0 54

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