Service exports (BoP, current US$)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 128,874,452 +69.9% 110
Albania Albania 8,031,895,336 +12.9% 66
Argentina Argentina 17,122,406,906 +6.28% 50
Armenia Armenia 5,682,935,856 -0.133% 75
Antigua & Barbuda Antigua & Barbuda 1,241,419,419 +12.9% 93
Australia Australia 83,386,076,110 +8.9% 23
Austria Austria 94,303,390,217 +4.43% 22
Azerbaijan Azerbaijan 8,120,879,000 +29.2% 64
Belgium Belgium 148,182,016,221 -2.88% 15
Bangladesh Bangladesh 6,652,036,784 +4.29% 71
Bulgaria Bulgaria 16,626,460,000 +1.7% 52
Bahrain Bahrain 17,025,000,000 +9.62% 51
Bahamas Bahamas 5,896,984,361 +14.5% 74
Bosnia & Herzegovina Bosnia & Herzegovina 3,740,016,887 +5.21% 82
Belarus Belarus 9,889,470,470 +14% 62
Belize Belize 1,157,918,437 +10.5% 95
Brazil Brazil 48,476,770,634 +6.84% 33
Brunei Brunei 409,655,983 +20.5% 102
Bhutan Bhutan 288,136,244 +127% 105
Canada Canada 159,075,382,630 +3.02% 13
Switzerland Switzerland 179,834,839,845 +8.81% 11
Chile Chile 11,957,320,639 +16.3% 60
China China 383,959,880,583 +16.8% 6
Colombia Colombia 17,780,007,721 +10.9% 48
Cape Verde Cape Verde 830,391,553 +16% 97
Costa Rica Costa Rica 16,113,784,566 +8.9% 53
Cyprus Cyprus 30,725,167,862 +8.94% 40
Czechia Czechia 42,539,017,982 +7.53% 35
Germany Germany 471,582,221,930 +4.2% 3
Djibouti Djibouti 1,173,078,423 +6.15% 94
Dominica Dominica 190,714,016 +17.1% 108
Denmark Denmark 127,108,619,356 +9.51% 17
Dominican Republic Dominican Republic 14,691,100,000 +14.4% 55
Ecuador Ecuador 3,769,129,569 -10.3% 81
Spain Spain 220,371,720,132 +11.8% 10
Estonia Estonia 13,514,263,609 +6.64% 58
Finland Finland 41,218,546,444 +11.7% 37
France France 400,103,952,726 +8.14% 4
United Kingdom United Kingdom 649,278,415,070 +10.7% 2
Georgia Georgia 7,699,911,956 +9.16% 67
Gambia Gambia 475,091,067 +21.2% 100
Greece Greece 55,809,407,774 +5.04% 29
Grenada Grenada 788,534,108 +4.4% 98
Guatemala Guatemala 4,667,670,440 +8.7% 79
Hong Kong SAR China Hong Kong SAR China 108,762,377,425 +11.7% 21
Honduras Honduras 3,678,944,612 -3.68% 83
Croatia Croatia 24,694,192,905 +1.61% 42
Hungary Hungary 38,303,865,515 +3.04% 39
Indonesia Indonesia 39,029,764,328 +16.1% 38
India India 374,879,313,857 +11.1% 7
Iceland Iceland 6,898,128,381 +0.778% 70
Israel Israel 83,041,600,000 +1.7% 24
Italy Italy 155,270,705,616 +5.41% 14
Jamaica Jamaica 5,256,028,511 -0.322% 76
Japan Japan 227,964,593,806 +9.24% 9
Kazakhstan Kazakhstan 11,828,321,750 +10.8% 61
Cambodia Cambodia 4,960,590,978 +18.4% 78
St. Kitts & Nevis St. Kitts & Nevis 470,693,038 -14.6% 101
South Korea South Korea 138,952,700,000 +10.6% 16
Kuwait Kuwait 12,218,417,787 +8.11% 59
St. Lucia St. Lucia 1,463,166,469 +14.7% 89
Lesotho Lesotho 15,405,551 -10.2% 113
Lithuania Lithuania 24,196,653,152 +12.9% 44
Luxembourg Luxembourg 171,242,194,406 +3.6% 12
Latvia Latvia 8,362,883,643 +2.94% 63
Moldova Moldova 2,703,730,000 +10.8% 86
Maldives Maldives 5,029,804,432 +12.8% 77
Mexico Mexico 63,034,084,919 +12.2% 26
North Macedonia North Macedonia 3,163,088,401 +10.3% 84
Malta Malta 24,663,225,864 +10.5% 43
Montenegro Montenegro 2,915,081,529 -2.67% 85
Mozambique Mozambique 1,146,959,526 +1.66% 96
Malaysia Malaysia 53,402,361,578 +25.1% 31
Namibia Namibia 1,287,847,419 +20.4% 91
Nigeria Nigeria 4,565,221,443 +2.81% 80
Nicaragua Nicaragua 1,298,118,290 -16.7% 90
Netherlands Netherlands 309,268,136,500 +6.58% 8
Norway Norway 56,850,553,617 +6.71% 28
Nepal Nepal 1,842,069,167 +106% 88
New Zealand New Zealand 18,504,852,880 +12.2% 46
Pakistan Pakistan 8,096,794,534 +9.33% 65
Panama Panama 18,267,678,139 +2.79% 47
Peru Peru 7,152,907,339 +22% 68
Philippines Philippines 51,977,999,883 +7.54% 32
Poland Poland 118,714,000,000 +9.09% 18
Portugal Portugal 62,298,595,014 +8.2% 27
Paraguay Paraguay 2,654,147,409 +8.1% 87
Palestinian Territories Palestinian Territories 514,284,473 -42.2% 99
Qatar Qatar 30,172,252,747 -2.59% 41
Romania Romania 42,933,131,922 +0.0289% 34
Russia Russia 42,185,550,000 +4.23% 36
Saudi Arabia Saudi Arabia 55,277,135,153 +13.9% 30
Singapore Singapore 395,565,869,234 +10.4% 5
Solomon Islands Solomon Islands 132,632,606 +15.1% 109
El Salvador El Salvador 5,999,510,604 +17.4% 73
Suriname Suriname 211,424,414 +21.9% 106
Slovakia Slovakia 13,562,516,851 +1.5% 56
Slovenia Slovenia 13,522,501,850 +5% 57
Sweden Sweden 116,828,243,175 +9.75% 19
Thailand Thailand 72,142,163,405 +27.2% 25
Tajikistan Tajikistan 194,650,900 -20.1% 107
Timor-Leste Timor-Leste 82,067,349 +18.2% 112
Tonga Tonga 108,678,754 +31.9% 111
Trinidad & Tobago Trinidad & Tobago 1,259,365,501 +7.98% 92
Turkey Turkey 115,249,000,000 +8.12% 20
Ukraine Ukraine 17,226,000,000 +3.76% 49
Uruguay Uruguay 6,948,322,538 +0.968% 69
United States United States 1,107,359,000,000 +7.87% 1
Uzbekistan Uzbekistan 6,547,114,232 +20.5% 72
St. Vincent & Grenadines St. Vincent & Grenadines 365,989,474 +23.8% 103
Vietnam Vietnam 23,851,000,000 +17.7% 45
Samoa Samoa 327,496,076 +8.15% 104
South Africa South Africa 15,939,059,525 +11.8% 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 = 'BX.GSR.NFSV.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.NFSV.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))