Commercial service exports (current US$)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 126,557,613 +66.9% 109
Albania Albania 7,980,624,733 +13% 65
Argentina Argentina 16,877,752,679 +6.02% 50
Armenia Armenia 5,648,280,814 -0.141% 74
Antigua & Barbuda Antigua & Barbuda 1,238,858,857 +12.9% 92
Australia Australia 82,711,587,736 +8.96% 24
Austria Austria 93,427,331,331 +4.46% 22
Azerbaijan Azerbaijan 8,084,308,000 +29.2% 64
Belgium Belgium 145,429,261,782 -3.23% 15
Bangladesh Bangladesh 5,052,258,329 +12.3% 76
Bulgaria Bulgaria 16,564,830,000 +1.85% 51
Bahrain Bahrain 17,025,000,000 +9.62% 49
Bahamas Bahamas 5,838,371,692 +14.7% 73
Bosnia & Herzegovina Bosnia & Herzegovina 3,733,854,835 +5.19% 81
Belarus Belarus 9,889,470,470 +14% 62
Belize Belize 1,109,753,559 +12.7% 95
Brazil Brazil 47,707,681,688 +7.33% 33
Brunei Brunei 390,567,995 +21.7% 102
Bhutan Bhutan 257,086,032 +106% 105
Canada Canada 157,869,070,950 +3.18% 13
Switzerland Switzerland 177,191,141,365 +8.92% 11
Chile Chile 11,534,147,813 +16.8% 61
China China 382,416,592,213 +16.9% 6
Colombia Colombia 17,541,865,560 +11.1% 48
Cape Verde Cape Verde 806,157,755 +16.4% 97
Costa Rica Costa Rica 16,079,204,566 +8.91% 53
Cyprus Cyprus 30,573,251,784 +9.05% 40
Czechia Czechia 42,518,273,319 +7.53% 35
Germany Germany 465,752,036,693 +4.21% 3
Djibouti Djibouti 842,191,646 +8.05% 96
Dominica Dominica 178,468,833 +11.5% 108
Denmark Denmark 126,626,636,881 +9.55% 17
Dominican Republic Dominican Republic 14,362,000,000 +14.7% 55
Ecuador Ecuador 3,652,560,135 -10.3% 82
Spain Spain 220,371,720,132 +11.8% 10
Estonia Estonia 13,443,910,157 +6.52% 58
Finland Finland 41,090,839,317 +11.8% 37
France France 398,371,908,855 +8.22% 4
United Kingdom United Kingdom 644,864,382,280 +10.5% 2
Georgia Georgia 7,588,049,436 +9.1% 66
Gambia Gambia 475,091,067 +21.2% 99
Greece Greece 55,655,373,320 +5.04% 29
Grenada Grenada 786,868,619 +4.4% 98
Guatemala Guatemala 4,572,167,170 +8.73% 79
Hong Kong SAR China Hong Kong SAR China 108,762,377,425 +11.8% 21
Honduras Honduras 3,612,864,280 -3.71% 83
Croatia Croatia 24,694,192,905 +1.61% 42
Hungary Hungary 38,113,070,761 +3.08% 39
Indonesia Indonesia 38,763,687,828 +16.5% 38
India India 374,274,753,904 +11.1% 7
Iceland Iceland 6,873,823,339 +0.762% 70
Israel Israel 83,012,500,000 +1.7% 23
Italy Italy 154,301,744,900 +5.46% 14
Jamaica Jamaica 5,224,620,934 -0.324% 75
Japan Japan 224,752,178,150 +9.52% 9
Kazakhstan Kazakhstan 11,550,111,750 +10.9% 60
Cambodia Cambodia 4,809,616,709 +17.2% 78
St. Kitts & Nevis St. Kitts & Nevis 411,045,147 +0.354% 101
South Korea South Korea 138,166,700,000 +11% 16
Kuwait Kuwait 11,663,856,590 +8.52% 59
St. Lucia St. Lucia 1,460,228,570 +14.8% 89
Lesotho Lesotho 13,422,942 -11.6% 113
Lithuania Lithuania 24,126,363,371 +12.9% 44
Luxembourg Luxembourg 170,392,936,440 +3.62% 12
Latvia Latvia 8,328,285,928 +2.96% 63
Moldova Moldova 2,645,340,000 +10.7% 86
Maldives Maldives 5,018,481,649 +12.8% 77
Mexico Mexico 62,846,093,917 +12.3% 26
North Macedonia North Macedonia 3,158,564,551 +10.3% 84
Malta Malta 24,628,524,836 +10.6% 43
Montenegro Montenegro 2,915,212,988 -2.67% 85
Mozambique Mozambique 1,146,959,526 +1.66% 94
Malaysia Malaysia 53,326,261,491 +25.2% 30
Namibia Namibia 1,250,928,130 +21.4% 90
Nigeria Nigeria 4,067,698,384 +2.62% 80
Nicaragua Nicaragua 1,190,818,290 -17.9% 93
Netherlands Netherlands 307,795,457,738 +6.5% 8
Norway Norway 56,737,177,844 +6.73% 28
Nepal Nepal 1,520,125,204 +97.3% 88
New Zealand New Zealand 18,308,070,461 +12.3% 46
Pakistan Pakistan 7,045,794,534 +12.2% 67
Panama Panama 18,131,693,115 +2.66% 47
Peru Peru 6,964,892,414 +22.6% 68
Philippines Philippines 51,948,847,893 +7.54% 32
Poland Poland 118,281,000,000 +9.07% 18
Portugal Portugal 62,071,227,963 +8.19% 27
Paraguay Paraguay 2,448,527,574 +8.63% 87
Palestinian Territories Palestinian Territories 474,610,426 -43.7% 100
Qatar Qatar 29,653,846,154 -2.08% 41
Romania Romania 42,868,559,749 -0.00687% 34
Russia Russia 41,217,700,000 +3.86% 36
Saudi Arabia Saudi Arabia 52,898,234,393 +14.2% 31
Singapore Singapore 395,208,671,140 +10.4% 5
Solomon Islands Solomon Islands 122,732,387 +14.8% 110
El Salvador El Salvador 5,840,241,737 +18.2% 72
Suriname Suriname 202,324,122 +20.6% 106
Slovakia Slovakia 13,492,309,942 +1.28% 57
Slovenia Slovenia 13,504,775,483 +4.95% 56
Sweden Sweden 115,595,458,588 +9.42% 19
Thailand Thailand 71,355,542,222 +27.2% 25
Tajikistan Tajikistan 192,083,110 -19.6% 107
Timor-Leste Timor-Leste 69,310,981 +22.4% 112
Tonga Tonga 105,179,951 +31.7% 111
Trinidad & Tobago Trinidad & Tobago 1,242,742,887 +7.99% 91
Turkey Turkey 114,947,000,000 +8.39% 20
Ukraine Ukraine 16,554,000,000 +3.85% 52
Uruguay Uruguay 6,889,213,666 +0.977% 69
United States United States 1,076,649,000,000 +8.33% 1
Uzbekistan Uzbekistan 6,524,314,232 +20.5% 71
St. Vincent & Grenadines St. Vincent & Grenadines 364,568,798 +23.9% 103
Vietnam Vietnam 23,851,000,000 +17.7% 45
Samoa Samoa 327,496,076 +8.15% 104
South Africa South Africa 15,762,029,646 +12.7% 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 = 'TX.VAL.SERV.CD.WT'

# 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 <- 'TX.VAL.SERV.CD.WT'

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