Logistics performance index: Quality of trade and transport-related infrastructure (1=low to 5=high)

Source: worldbank.org, 03.09.2025

Year: 2022

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 1.7 -6.08% 29
Angola Angola 2.1 +12.9% 25
Albania Albania 2.7 +17.9% 19
United Arab Emirates United Arab Emirates 4.1 +1.99% 5
Argentina Argentina 2.8 +1.08% 18
Armenia Armenia 2.6 +4.84% 20
Antigua & Barbuda Antigua & Barbuda 2.7 19
Australia Australia 4.1 +3.27% 5
Austria Austria 3.9 -6.7% 7
Belgium Belgium 4.1 +3.02% 5
Benin Benin 2.5 0% 21
Burkina Faso Burkina Faso 2.3 -5.35% 23
Bangladesh Bangladesh 2.3 -3.77% 23
Bulgaria Bulgaria 3.1 +12.3% 15
Bahrain Bahrain 3.6 +32.4% 10
Bahamas Bahamas 2.5 +3.73% 21
Bosnia & Herzegovina Bosnia & Herzegovina 2.6 +7.44% 20
Belarus Belarus 2.7 +10.7% 19
Bolivia Bolivia 2.4 +11.6% 22
Brazil Brazil 3.2 +9.22% 14
Bhutan Bhutan 2.2 +15.2% 24
Botswana Botswana 3.1 +4.89% 15
Central African Republic Central African Republic 2.6 +34.7% 20
Canada Canada 4.3 +14.7% 3
Switzerland Switzerland 4.4 +9.45% 2
Chile Chile 2.8 -12.8% 18
China China 4 +6.67% 6
Cameroon Cameroon 2.1 -18.3% 25
Congo - Kinshasa Congo - Kinshasa 2.3 +8.49% 23
Congo - Brazzaville Congo - Brazzaville 2.1 +1.45% 25
Colombia Colombia 2.9 +8.61% 17
Costa Rica Costa Rica 2.7 +8.43% 19
Cuba Cuba 2.2 +7.84% 24
Cyprus Cyprus 2.8 -3.11% 18
Czechia Czechia 3 -13.3% 16
Germany Germany 4.3 -1.6% 3
Djibouti Djibouti 2.3 -17.6% 23
Denmark Denmark 4.1 +3.54% 5
Dominican Republic Dominican Republic 2.7 +14.4% 19
Algeria Algeria 2.1 -13.2% 25
Egypt Egypt 3 +6.38% 16
Spain Spain 3.8 -1.04% 8
Estonia Estonia 3.5 +12.9% 11
Finland Finland 4.2 +5% 4
Fiji Fiji 2.2 -8.33% 24
France France 3.8 -5% 8
Gabon Gabon 2.2 +5.26% 24
United Kingdom United Kingdom 3.7 -8.19% 9
Georgia Georgia 2.3 -3.36% 23
Ghana Ghana 2.4 -1.64% 22
Guinea Guinea 2.4 +53.8% 22
Gambia Gambia 2.3 +26.4% 23
Guinea-Bissau Guinea-Bissau 2.4 +34.8% 22
Greece Greece 3.7 +16.7% 9
Grenada Grenada 2.5 21
Guatemala Guatemala 2.4 +9.09% 22
Guyana Guyana 2.4 +14.8% 22
Hong Kong SAR China Hong Kong SAR China 4 +0.756% 6
Honduras Honduras 2.7 +9.31% 19
Croatia Croatia 3 -0.332% 16
Haiti Haiti 1.8 -7.22% 28
Hungary Hungary 3.1 -5.2% 15
Indonesia Indonesia 2.9 +0.346% 17
India India 3.2 +9.97% 14
Ireland Ireland 3.5 +6.38% 11
Iran Iran 2.4 -13.4% 22
Iraq Iraq 2.2 +8.37% 24
Iceland Iceland 3.6 +12.9% 10
Israel Israel 3.7 +11.1% 9
Italy Italy 3.8 -1.3% 8
Jamaica Jamaica 2.4 +3.45% 22
Japan Japan 4.2 -1.18% 4
Kazakhstan Kazakhstan 2.5 -1.96% 21
Kyrgyzstan Kyrgyzstan 2.4 +0.84% 22
Cambodia Cambodia 2.1 -1.87% 25
South Korea South Korea 4.1 +9.92% 5
Kuwait Kuwait 3.6 +19.2% 10
Laos Laos 2.3 -5.74% 23
Liberia Liberia 2.4 +25.7% 22
Libya Libya 1.7 -24.4% 29
Sri Lanka Sri Lanka 2.4 -3.61% 22
Lithuania Lithuania 3.5 +28.2% 11
Luxembourg Luxembourg 3.6 -0.826% 10
Latvia Latvia 3.3 +10.7% 13
Moldova Moldova 1.9 -5.94% 27
Madagascar Madagascar 1.8 -16.7% 28
Mexico Mexico 2.8 -1.75% 18
North Macedonia North Macedonia 3 +21.5% 16
Mali Mali 2 -13% 26
Malta Malta 3.7 +27.6% 9
Montenegro Montenegro 2.5 -2.72% 21
Mongolia Mongolia 2.3 +9.52% 23
Mauritania Mauritania 2 -11.5% 26
Mauritius Mauritius 2.5 -10.7% 21
Malaysia Malaysia 3.6 +14.3% 10
Namibia Namibia 2.8 +1.31% 18
Nigeria Nigeria 2.4 -6.25% 22
Nicaragua Nicaragua 1.9 -24% 27
Netherlands Netherlands 4.2 -0.238% 4
Norway Norway 3.9 +5.69% 7
New Zealand New Zealand 3.8 -4.76% 8
Oman Oman 3.2 +1.27% 14
Panama Panama 3.3 +5.43% 13
Peru Peru 2.5 +9.65% 21
Philippines Philippines 3.2 +17.2% 14
Papua New Guinea Papua New Guinea 2.4 +21.8% 22
Poland Poland 3.5 +9.03% 11
Portugal Portugal 3.6 +10.8% 10
Paraguay Paraguay 2.5 -1.96% 21
Qatar Qatar 3.8 +12.4% 8
Romania Romania 2.9 -0.344% 17
Russia Russia 2.7 -2.88% 19
Rwanda Rwanda 2.9 +5.07% 17
Saudi Arabia Saudi Arabia 3.6 +15.8% 10
Sudan Sudan 2.3 +5.5% 23
Singapore Singapore 4.6 +13.3% 1
Solomon Islands Solomon Islands 2.6 +17.6% 20
El Salvador El Salvador 2.2 -2.22% 24
Somalia Somalia 1.9 +4.97% 27
Serbia Serbia 2.4 -7.69% 22
Slovakia Slovakia 3.3 +10% 13
Slovenia Slovenia 3.6 +10.4% 10
Sweden Sweden 4.2 -0.943% 4
Syria Syria 2.2 -12.4% 24
Togo Togo 2.3 +3.14% 23
Thailand Thailand 3.7 +17.8% 9
Tajikistan Tajikistan 2.5 +15.2% 21
Trinidad & Tobago Trinidad & Tobago 2.4 +0.84% 22
Turkey Turkey 3.4 +5.92% 12
Ukraine Ukraine 2.4 +8.11% 22
Uruguay Uruguay 2.7 +11.1% 19
United States United States 3.9 -3.7% 7
Uzbekistan Uzbekistan 2.4 -6.61% 22
Venezuela Venezuela 2.4 +14.3% 22
Vietnam Vietnam 3.2 +6.31% 14
Yemen Yemen 1.9 -10.4% 27
South Africa South Africa 3.6 +12.9% 10
Zimbabwe Zimbabwe 2.4 +31.1% 22

                    
# 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 = 'LP.LPI.INFR.XQ'

# 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 <- 'LP.LPI.INFR.XQ'

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