Exports of goods and services (BoP, current US$)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 36,923,912,927 -0.0991% 63
Albania Albania 9,848,455,059 +8.24% 84
Argentina Argentina 96,899,305,499 +16.8% 45
Armenia Armenia 18,618,178,269 +29.8% 74
Antigua & Barbuda Antigua & Barbuda 1,313,549,083 +10.8% 101
Australia Australia 425,159,794,070 -5.21% 21
Austria Austria 299,366,149,993 -1.5% 30
Azerbaijan Azerbaijan 34,112,907,000 -3.87% 66
Belgium Belgium 525,458,415,833 -3.14% 17
Bangladesh Bangladesh 53,848,394,434 -8.55% 56
Bulgaria Bulgaria 62,660,850,000 -1.19% 51
Bahrain Bahrain 41,303,457,447 +2.38% 59
Bahamas Bahamas 6,770,777,776 +12.6% 89
Bosnia & Herzegovina Bosnia & Herzegovina 12,141,089,388 +0.126% 79
Belarus Belarus 49,385,770,470 +3.5% 57
Belize Belize 1,640,397,287 +6.79% 98
Brazil Brazil 388,333,170,596 -0.221% 22
Brunei Brunei 11,482,894,063 -0.778% 81
Bhutan Bhutan 944,390,565 +8.82% 104
Canada Canada 727,830,689,096 +0.424% 13
Switzerland Switzerland 675,059,011,323 +3.19% 15
Chile Chile 111,122,573,201 +7.62% 42
China China 3,792,950,717,268 +8.13% 1
Colombia Colombia 68,866,109,177 +0.28% 49
Cape Verde Cape Verde 1,158,230,560 +19.1% 102
Costa Rica Costa Rica 36,770,002,944 +9.16% 64
Cyprus Cyprus 35,119,658,480 +6.68% 65
Czechia Czechia 239,259,165,133 +1.34% 31
Germany Germany 1,949,101,561,120 -0.451% 3
Djibouti Djibouti 5,249,603,489 -10.7% 93
Dominica Dominica 212,752,621 +12.7% 112
Denmark Denmark 299,404,708,060 +8.23% 29
Dominican Republic Dominican Republic 28,563,200,000 +10.8% 70
Ecuador Ecuador 38,468,158,328 +7.79% 61
Spain Spain 642,357,925,517 +4.17% 16
Estonia Estonia 32,636,797,985 +1.52% 67
Finland Finland 124,530,872,166 -2.02% 40
France France 1,071,123,428,598 +2.05% 5
United Kingdom United Kingdom 1,116,624,405,568 +3.59% 4
Georgia Georgia 16,321,497,699 +7.57% 77
Gambia Gambia 838,409,239 +16.8% 106
Greece Greece 108,423,534,630 +1.12% 43
Grenada Grenada 858,948,845 +3.67% 105
Guatemala Guatemala 17,996,793,720 +3.78% 75
Hong Kong SAR China Hong Kong SAR China 739,915,056,500 +9.82% 12
Honduras Honduras 9,352,251,978 -4.61% 86
Croatia Croatia 46,600,628,295 +3.41% 58
Hungary Hungary 166,502,872,027 -3.77% 34
Indonesia Indonesia 300,868,333,570 +3.29% 28
India India 822,045,800,090 +6.32% 10
Iceland Iceland 13,915,793,784 +1.56% 78
Israel Israel 153,248,000,000 -0.899% 35
Italy Italy 778,897,611,250 +0.592% 11
Jamaica Jamaica 7,123,673,192 -2.08% 88
Japan Japan 922,447,048,199 -0.113% 8
Kazakhstan Kazakhstan 91,908,363,755 +1.08% 46
Cambodia Cambodia 31,712,263,584 +14.3% 68
St. Kitts & Nevis St. Kitts & Nevis 504,391,468 -13% 108
South Korea South Korea 835,148,800,000 +8.57% 9
Kuwait Kuwait 89,709,774,994 -6.04% 47
St. Lucia St. Lucia 1,599,910,568 +12.7% 100
Lesotho Lesotho 983,027,162 +11% 103
Lithuania Lithuania 62,895,716,014 +3.07% 50
Luxembourg Luxembourg 202,203,242,548 +3.54% 33
Latvia Latvia 28,116,880,805 -0.625% 71
Moldova Moldova 5,717,250,000 -2.54% 91
Maldives Maldives 5,412,511,018 +10.9% 92
Mexico Mexico 680,798,159,649 +4.78% 14
North Macedonia North Macedonia 10,445,052,900 -2.3% 83
Malta Malta 29,244,840,225 +9.75% 69
Montenegro Montenegro 3,628,877,473 -3.72% 95
Mozambique Mozambique 9,358,247,972 -0.494% 85
Malaysia Malaysia 301,788,640,251 +10.1% 27
Namibia Namibia 5,886,975,586 +2.76% 90
Nigeria Nigeria 57,536,063,917 -4.52% 54
Nicaragua Nicaragua 8,134,718,290 -1.37% 87
Netherlands Netherlands 1,032,468,130,552 +1.02% 6
Norway Norway 229,205,141,440 -0.726% 32
Nepal Nepal 3,744,420,963 +65.8% 94
New Zealand New Zealand 61,798,658,712 +4.69% 52
Pakistan Pakistan 40,218,794,534 +11.1% 60
Panama Panama 37,376,157,148 -1.4% 62
Peru Peru 83,324,835,863 +14.2% 48
Philippines Philippines 106,989,626,346 +3.28% 44
Poland Poland 478,579,000,000 +1.49% 18
Portugal Portugal 144,236,940,228 +4.57% 36
Paraguay Paraguay 17,395,433,215 -6.38% 76
Palestinian Territories Palestinian Territories 2,884,800,000 -15.5% 96
Qatar Qatar 125,216,483,516 -2.71% 39
Romania Romania 136,252,875,934 -0.172% 37
Russia Russia 475,277,220,000 +2.16% 19
Saudi Arabia Saudi Arabia 360,897,358,999 -2.12% 25
Singapore Singapore 978,597,275,925 +6.64% 7
Solomon Islands Solomon Islands 642,876,797 +17.7% 107
El Salvador El Salvador 11,585,807,418 +9% 80
Suriname Suriname 2,793,401,415 +10.3% 97
Slovakia Slovakia 120,354,771,304 -1.38% 41
Slovenia Slovenia 59,159,001,065 +2.6% 53
Sweden Sweden 338,851,684,857 +2.89% 26
Thailand Thailand 369,190,719,496 +9.41% 24
Tajikistan Tajikistan 1,617,571,404 -23.2% 99
Timor-Leste Timor-Leste 278,047,420 -60.4% 111
Tonga Tonga 119,511,326 +25.3% 113
Trinidad & Tobago Trinidad & Tobago 11,086,566,693 -3.97% 82
Turkey Turkey 372,756,000,000 +4.24% 23
Ukraine Ukraine 56,114,000,000 +9.43% 55
Uruguay Uruguay 23,329,137,962 +6.3% 73
United States United States 3,190,604,000,000 +3.87% 2
Uzbekistan Uzbekistan 26,173,189,942 +4.49% 72
St. Vincent & Grenadines St. Vincent & Grenadines 425,181,985 +23.2% 109
Vietnam Vietnam 429,383,000,000 +14.5% 20
Samoa Samoa 369,729,769 +6.8% 110
South Africa South Africa 127,629,476,196 +2.37% 38

                    
# 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 = 'BX.GSR.GNFS.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 <- 'BX.GSR.GNFS.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))