Service imports (BoP, current US$)

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 8,492,283,242 -1.29% 63
Albania Albania 3,828,555,761 +10.1% 76
Argentina Argentina 22,598,388,496 +0.319% 44
Armenia Armenia 3,847,153,472 +14.2% 75
Antigua & Barbuda Antigua & Barbuda 556,628,452 +5.11% 100
Australia Australia 108,665,989,204 +7.28% 19
Austria Austria 87,983,668,325 +4.25% 23
Azerbaijan Azerbaijan 10,171,724,000 +18% 61
Belgium Belgium 158,993,405,816 -0.325% 14
Bangladesh Bangladesh 11,312,832,001 +2.72% 57
Bulgaria Bulgaria 8,204,780,000 +4.59% 65
Bahrain Bahrain 12,373,936,170 +2.58% 56
Bahamas Bahamas 2,472,835,226 +12.5% 85
Bosnia & Herzegovina Bosnia & Herzegovina 1,301,107,447 +15.7% 94
Belarus Belarus 6,481,623,115 +9.97% 67
Belize Belize 362,314,446 +17.7% 103
Brazil Brazil 103,035,975,174 +16.2% 20
Brunei Brunei 1,746,204,731 +6.36% 91
Bhutan Bhutan 227,833,100 -29.5% 108
Canada Canada 160,061,443,575 +4.95% 13
Switzerland Switzerland 214,617,321,506 +11.6% 9
Chile Chile 21,106,235,969 +0.901% 46
China China 612,978,060,796 +14.1% 2
Colombia Colombia 18,386,361,196 +8.16% 49
Cape Verde Cape Verde 299,810,294 +7.72% 105
Costa Rica Costa Rica 7,293,406,182 +14.5% 66
Cyprus Cyprus 22,003,639,923 +11% 45
Czechia Czechia 38,017,590,524 +6.79% 34
Germany Germany 551,800,989,819 +5.85% 3
Djibouti Djibouti 729,630,114 -7.32% 98
Dominica Dominica 156,781,881 +3.35% 112
Denmark Denmark 121,197,813,816 +7.15% 17
Dominican Republic Dominican Republic 6,336,500,000 +12.4% 69
Ecuador Ecuador 6,083,957,026 -0.97% 71
Spain Spain 111,558,518,699 +16.4% 18
Estonia Estonia 10,341,904,457 +4.91% 60
Finland Finland 46,726,254,263 +2.31% 32
France France 340,436,201,988 +2.7% 6
United Kingdom United Kingdom 401,774,108,284 +10.5% 4
Georgia Georgia 3,822,908,766 +5.64% 77
Gambia Gambia 160,904,229 +7.13% 111
Greece Greece 31,213,224,333 +6.04% 38
Grenada Grenada 428,763,994 +9.92% 101
Guatemala Guatemala 6,444,602,000 +14.3% 68
Hong Kong SAR China Hong Kong SAR China 90,279,136,204 +14.3% 22
Honduras Honduras 3,657,967,552 +2.02% 78
Croatia Croatia 8,348,970,061 +17.6% 64
Hungary Hungary 27,394,914,797 +1.6% 42
Indonesia Indonesia 57,511,875,417 +12.1% 29
India India 196,677,323,400 +10.2% 10
Iceland Iceland 5,002,202,594 +7.04% 74
Israel Israel 43,908,500,000 -6.32% 33
Italy Italy 162,797,965,156 +6.98% 11
Jamaica Jamaica 3,457,421,854 -0.197% 79
Japan Japan 246,310,848,083 +5.78% 8
Kazakhstan Kazakhstan 13,049,384,357 +5.97% 55
Cambodia Cambodia 3,081,773,248 +7.38% 81
St. Kitts & Nevis St. Kitts & Nevis 238,860,228 -18.7% 107
South Korea South Korea 162,654,300,000 +6.67% 12
Kuwait Kuwait 28,077,485,650 -7.65% 40
St. Lucia St. Lucia 597,609,900 +10.8% 99
Lesotho Lesotho 414,996,556 +0.293% 102
Lithuania Lithuania 14,682,632,251 +9.56% 53
Luxembourg Luxembourg 130,659,206,436 +2.72% 15
Latvia Latvia 5,914,082,602 +2.75% 72
Moldova Moldova 1,784,930,000 +15.5% 90
Maldives Maldives 1,885,374,975 +11.7% 89
Mexico Mexico 71,056,765,961 -5.98% 27
North Macedonia North Macedonia 2,009,290,851 -3.21% 88
Malta Malta 17,199,789,582 +9.87% 51
Montenegro Montenegro 1,190,414,521 +2.46% 95
Mozambique Mozambique 2,112,555,385 +5.61% 87
Malaysia Malaysia 56,370,777,860 +8% 30
Namibia Namibia 2,428,923,918 +8.59% 86
Nigeria Nigeria 17,925,790,455 +1.41% 50
Nicaragua Nicaragua 1,306,000,000 +14.7% 93
Netherlands Netherlands 268,041,519,257 +5.84% 7
Norway Norway 64,210,804,465 +6.95% 28
Nepal Nepal 2,813,995,722 +37.2% 82
New Zealand New Zealand 19,467,312,375 +5.56% 48
Pakistan Pakistan 11,168,574,086 +14.8% 58
Panama Panama 5,746,170,486 -2.72% 73
Peru Peru 15,068,566,343 +9.05% 52
Philippines Philippines 37,398,270,378 +24% 35
Poland Poland 75,176,000,000 +13.6% 25
Portugal Portugal 27,707,438,395 +6.9% 41
Paraguay Paraguay 2,541,572,752 +1.46% 84
Palestinian Territories Palestinian Territories 1,390,509,522 -30.2% 92
Qatar Qatar 37,085,164,835 -13.2% 36
Romania Romania 30,648,607,722 +7.42% 39
Russia Russia 81,326,120,000 +6.21% 24
Saudi Arabia Saudi Arabia 101,664,647,256 +3.83% 21
Singapore Singapore 351,122,433,707 +7.62% 5
Solomon Islands Solomon Islands 248,415,612 -2.26% 106
El Salvador El Salvador 3,258,974,319 +22.5% 80
Suriname Suriname 920,532,199 +45.8% 97
Slovakia Slovakia 13,063,999,667 +5.84% 54
Slovenia Slovenia 9,590,558,749 +6.6% 62
Sweden Sweden 124,964,928,857 +9.35% 16
Thailand Thailand 73,643,648,418 +12.2% 26
Tajikistan Tajikistan 970,651,649 +29.7% 96
Timor-Leste Timor-Leste 357,150,156 -9.9% 104
Tonga Tonga 161,065,222 +7.47% 110
Trinidad & Tobago Trinidad & Tobago 2,684,547,237 +3.14% 83
Turkey Turkey 53,257,000,000 +7.98% 31
Ukraine Ukraine 22,734,000,000 -10.3% 43
Uruguay Uruguay 6,205,519,842 -3.19% 70
United States United States 812,204,000,000 +8.56% 1
Uzbekistan Uzbekistan 10,464,185,997 +28.1% 59
St. Vincent & Grenadines St. Vincent & Grenadines 196,315,273 +5.25% 109
Vietnam Vietnam 36,183,000,000 +24.4% 37
Samoa Samoa 128,030,310 -2.63% 113
South Africa South Africa 19,761,492,503 +6.32% 47

                    
# 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 = 'BM.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 <- 'BM.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))