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

Source: worldbank.org, 03.09.2025

Year: 2024

Flag Country Value Value change, % Rank
Angola Angola 22,682,525,278 -4.24% 73
Albania Albania 11,696,529,916 +12.8% 84
Argentina Argentina 79,998,522,783 -13.3% 45
Armenia Armenia 19,086,880,609 +31.3% 75
Antigua & Barbuda Antigua & Barbuda 1,282,230,314 +0.69% 105
Australia Australia 405,336,357,225 +4.14% 19
Austria Austria 284,467,308,595 -3.14% 27
Azerbaijan Azerbaijan 27,338,808,000 +9.28% 71
Belgium Belgium 531,029,440,251 -2.82% 17
Bangladesh Bangladesh 74,959,772,435 +2.44% 47
Bulgaria Bulgaria 60,029,170,000 +1.47% 54
Bahrain Bahrain 33,044,414,894 +2.07% 66
Bahamas Bahamas 7,068,647,426 +12.7% 93
Bosnia & Herzegovina Bosnia & Herzegovina 16,202,034,953 +5.42% 81
Belarus Belarus 50,678,823,115 +6.78% 58
Belize Belize 1,724,316,943 +9.61% 100
Brazil Brazil 377,050,080,479 +10.8% 22
Brunei Brunei 9,110,495,538 +0.369% 91
Bhutan Bhutan 1,512,981,737 -14.5% 102
Canada Canada 733,777,721,186 +1.43% 11
Switzerland Switzerland 582,554,356,568 +4.71% 15
Chile Chile 99,238,957,067 -0.842% 43
China China 3,253,992,699,024 +4.22% 2
Colombia Colombia 78,632,817,462 +2.86% 46
Cape Verde Cape Verde 1,473,225,763 +3.14% 103
Costa Rica Costa Rica 30,459,218,674 +7.2% 69
Cyprus Cyprus 33,801,825,003 +3.83% 65
Czechia Czechia 216,741,016,051 -1.07% 31
Germany Germany 1,774,301,331,131 -0.383% 3
Djibouti Djibouti 4,764,705,083 -9.57% 97
Dominica Dominica 387,532,461 -7.1% 113
Denmark Denmark 252,953,812,953 +3.89% 30
Dominican Republic Dominican Republic 36,144,500,000 +4.92% 61
Ecuador Ecuador 33,969,947,198 -4.1% 64
Spain Spain 568,501,692,612 +2.81% 16
Estonia Estonia 32,374,650,458 +1.82% 67
Finland Finland 122,643,844,271 -2.8% 39
France France 1,074,434,908,748 -1.74% 5
United Kingdom United Kingdom 1,157,848,698,038 +3.92% 4
Georgia Georgia 18,914,647,054 +6.17% 76
Gambia Gambia 1,549,228,969 +14.5% 101
Greece Greece 122,408,347,595 +2.66% 40
Grenada Grenada 990,587,401 +7.13% 107
Guatemala Guatemala 35,576,104,500 +7.62% 62
Hong Kong SAR China Hong Kong SAR China 723,396,681,954 +7.73% 12
Honduras Honduras 18,234,549,521 +1.72% 79
Croatia Croatia 49,859,892,497 +6.51% 59
Hungary Hungary 154,076,950,204 -5.59% 36
Indonesia Indonesia 279,418,843,146 +6.37% 28
India India 923,080,597,400 +7.4% 7
Iceland Iceland 14,298,057,344 +4.9% 82
Israel Israel 140,437,800,000 +0.00441% 37
Italy Italy 717,277,529,572 -3.02% 13
Jamaica Jamaica 9,524,445,779 -3.46% 89
Japan Japan 965,047,346,579 -3.14% 6
Kazakhstan Kazakhstan 74,245,641,889 +2.09% 48
Cambodia Cambodia 34,329,032,394 +16.7% 63
St. Kitts & Nevis St. Kitts & Nevis 642,934,302 -3.92% 109
South Korea South Korea 758,723,500,000 +0.0414% 10
Kuwait Kuwait 61,520,891,186 -3.01% 53
St. Lucia St. Lucia 1,445,677,124 +11.9% 104
Lesotho Lesotho 2,082,725,726 +0.282% 99
Lithuania Lithuania 58,491,345,843 +1.02% 55
Luxembourg Luxembourg 160,032,087,317 +2.05% 34
Latvia Latvia 29,234,084,508 -2.14% 70
Moldova Moldova 10,418,370,000 +5.88% 87
Maldives Maldives 5,344,487,632 +7.24% 96
Mexico Mexico 697,066,723,384 +3.32% 14
North Macedonia North Macedonia 12,643,717,502 -0.819% 83
Malta Malta 24,504,911,237 +8.25% 72
Montenegro Montenegro 5,477,724,144 +6.01% 95
Mozambique Mozambique 10,487,702,640 -6.19% 86
Malaysia Malaysia 279,090,346,965 +10% 29
Namibia Namibia 9,199,425,098 +8.96% 90
Nigeria Nigeria 57,730,449,623 -11.8% 56
Nicaragua Nicaragua 11,437,300,000 +8.73% 85
Netherlands Netherlands 884,154,370,375 -1.01% 8
Norway Norway 162,467,147,023 +4.07% 32
Nepal Nepal 17,777,041,054 +28.1% 80
New Zealand New Zealand 67,998,492,485 -0.604% 50
Pakistan Pakistan 66,843,574,086 +15.1% 52
Panama Panama 30,886,790,934 -14% 68
Peru Peru 67,159,919,996 +5.31% 51
Philippines Philippines 161,154,243,006 +6.41% 33
Poland Poland 441,945,000,000 +4.28% 18
Portugal Portugal 136,976,460,933 +2.51% 38
Paraguay Paraguay 18,376,906,674 +2.97% 77
Palestinian Territories Palestinian Territories 8,264,255,681 -29% 92
Qatar Qatar 69,692,032,967 -3.44% 49
Romania Romania 159,575,094,722 +4.01% 35
Russia Russia 381,450,480,000 +0.472% 21
Saudi Arabia Saudi Arabia 317,011,653,030 +9.35% 25
Singapore Singapore 786,020,430,564 +7.9% 9
Solomon Islands Solomon Islands 857,128,261 -3% 108
El Salvador El Salvador 18,354,040,667 +7.75% 78
Suriname Suriname 2,571,185,114 +16.7% 98
Slovakia Slovakia 120,289,916,082 +0.46% 41
Slovenia Slovenia 54,582,845,880 +2.39% 57
Sweden Sweden 309,525,682,943 +1.75% 26
Thailand Thailand 351,418,674,357 +7.46% 24
Tajikistan Tajikistan 6,906,919,389 +16.4% 94
Timor-Leste Timor-Leste 1,197,306,932 +2.4% 106
Tonga Tonga 392,887,841 +2.45% 112
Trinidad & Tobago Trinidad & Tobago 10,189,963,668 +10.5% 88
Turkey Turkey 367,022,000,000 -5.06% 23
Ukraine Ukraine 92,025,000,000 +3.21% 44
Uruguay Uruguay 19,117,250,889 -0.738% 74
United States United States 4,108,442,000,000 +6.53% 1
Uzbekistan Uzbekistan 43,624,151,241 +2.29% 60
St. Vincent & Grenadines St. Vincent & Grenadines 641,178,788 +8.88% 110
Vietnam Vietnam 398,672,000,000 +17.3% 20
Samoa Samoa 575,749,112 +2.67% 111
South Africa South Africa 119,589,982,001 -3.13% 42

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