Trade in services (% of GDP)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 10.7 +4.87% 95
Albania Albania 43.6 -2.98% 24
Argentina Argentina 6.27 +4.88% 108
Armenia Armenia 37 -1.75% 30
Antigua & Barbuda Antigua & Barbuda 80.8 -0.499% 8
Australia Australia 11 +6.49% 93
Austria Austria 34.9 +2.35% 33
Azerbaijan Azerbaijan 24.6 +19.6% 53
Belgium Belgium 46.2 -4.52% 21
Bangladesh Bangladesh 3.99 +0.378% 112
Bulgaria Bulgaria 22.1 -6.34% 60
Bahrain Bahrain 61.6 +3.1% 10
Bahamas Bahamas 52.9 +9.89% 13
Bosnia & Herzegovina Bosnia & Herzegovina 17.8 +4.87% 72
Belarus Belarus 21.6 +7.21% 63
Belize Belize 43.2 -2.19% 25
Brazil Brazil 6.95 +13.7% 105
Brunei Brunei 13.9 +6.2% 83
Bhutan Bhutan 15.8 +5.85% 76
Canada Canada 14.2 +0.827% 82
Switzerland Switzerland 42.1 +5.33% 27
Chile Chile 10 +7.66% 96
China China 5.32 +12.2% 110
Colombia Colombia 8.64 -4.18% 99
Cape Verde Cape Verde 40.8 +4.32% 28
Costa Rica Costa Rica 24.5 +0.329% 54
Cyprus Cyprus 145 +2.4% 3
Czechia Czechia 23.3 +6.61% 58
Germany Germany 22 +2.06% 61
Djibouti Djibouti 46.6 -3.62% 20
Dominica Dominica 50.4 +5.72% 15
Denmark Denmark 57.8 +2.7% 11
Dominican Republic Dominican Republic 16.9 +10.3% 74
Ecuador Ecuador 7.9 -7.47% 102
Spain Spain 19.3 +6.56% 68
Estonia Estonia 55.8 +2.23% 12
Finland Finland 29.3 +4.79% 41
France France 23.4 +1.89% 57
United Kingdom United Kingdom 28.8 +2.29% 43
Georgia Georgia 34.1 -1.62% 34
Gambia Gambia 25.4 +12.1% 49
Greece Greece 33.8 -0.195% 35
Grenada Grenada 87.5 +1.13% 6
Guatemala Guatemala 9.82 +3.13% 97
Hong Kong SAR China Hong Kong SAR China 48.9 +5.66% 17
Honduras Honduras 19.8 -8.23% 66
Croatia Croatia 35.7 -4.02% 31
Hungary Hungary 29.5 -1.65% 40
Indonesia Indonesia 6.91 +11.7% 106
India India 14.6 +3.02% 79
Iceland Iceland 35.6 -2.89% 32
Israel Israel 23.5 -6.38% 56
Italy Italy 13.4 +3.16% 85
Jamaica Jamaica 43.7 -2.81% 23
Japan Japan 11.8 +12.4% 91
Kazakhstan Kazakhstan 8.63 -1.75% 100
Cambodia Cambodia 17.4 +4.07% 73
St. Kitts & Nevis St. Kitts & Nevis 66.5 -16.8% 9
Kuwait Kuwait 25.1 -0.267% 50
St. Lucia St. Lucia 80.8 +8.26% 7
Lesotho Lesotho 18.9 -6.88% 70
Lithuania Lithuania 45.8 +4.91% 22
Luxembourg Luxembourg 324 -3.01% 1
Latvia Latvia 32.8 +0.618% 36
Moldova Moldova 24.7 +3.4% 52
Maldives Maldives 99.1 +6.31% 5
Mexico Mexico 7.24 -1.44% 104
North Macedonia North Macedonia 31 -1.15% 38
Malta Malta 172 +0.694% 2
Montenegro Montenegro 50.9 -7.83% 14
Mozambique Mozambique 14.5 -2.61% 81
Malaysia Malaysia 26 +9.61% 48
Namibia Namibia 27.8 +4.3% 45
Nigeria Nigeria 12 +97.1% 90
Nicaragua Nicaragua 13.2 -12.7% 86
Netherlands Netherlands 47 -0.0958% 19
Norway Norway 25 +6.67% 51
Nepal Nepal 10.8 +51.2% 94
New Zealand New Zealand 14.6 +6.6% 80
Pakistan Pakistan 5.16 +1.82% 111
Panama Panama 27.8 -2.04% 44
Peru Peru 7.68 +4.22% 103
Philippines Philippines 19.4 +7.82% 67
Poland Poland 21.2 -1.59% 64
Portugal Portugal 29.2 +1.17% 42
Paraguay Paraguay 11.7 +1.59% 92
Palestinian Territories Palestinian Territories 13.9 -14% 84
Qatar Qatar 30.9 -10.9% 39
Romania Romania 19.2 -5.63% 69
Russia Russia 5.68 +0.558% 109
Saudi Arabia Saudi Arabia 12.7 +5.54% 88
Singapore Singapore 136 +0.727% 4
Solomon Islands Solomon Islands 21.6 -2.7% 62
El Salvador El Salvador 26.2 +14.1% 47
Suriname Suriname 24 +3.09% 55
Slovakia Slovakia 18.8 -2.17% 71
Slovenia Slovenia 31.9 +0.794% 37
Sweden Sweden 39.6 +5.12% 29
Thailand Thailand 27.7 +16.8% 46
Tajikistan Tajikistan 8.2 +1.28% 101
Timor-Leste Timor-Leste 23.3 +4.25% 59
Tonga Tonga 49.9 +9.27% 16
Trinidad & Tobago Trinidad & Tobago 14.9 +0.915% 77
Turkey Turkey 12.7 -8.67% 87
Ukraine Ukraine 20.9 -9.49% 65
Uruguay Uruguay 16.2 -4.67% 75
United States United States 6.58 +2.73% 107
Uzbekistan Uzbekistan 14.8 +11.6% 78
St. Vincent & Grenadines St. Vincent & Grenadines 48.6 +8.06% 18
Vietnam Vietnam 12.6 +10.8% 89
Samoa Samoa 42.7 -7.86% 26
South Africa South Africa 8.92 +3.4% 98

                    
# 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 = 'BG.GSR.NFSV.GD.ZS'

# 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 <- 'BG.GSR.NFSV.GD.ZS'

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