Machinery and transport equipment (% of value added in manufacturing)

Source: worldbank.org, 03.09.2025

Year: 2021

Flag Country Value Value change, % Rank
Albania Albania 110 +1.24% 49
United Arab Emirates United Arab Emirates 5.27 -17.7% 78
Argentina Argentina 13.2 +21.9% 77
Armenia Armenia 105 -1.51% 57
Australia Australia 39.5 +3.61% 68
Austria Austria 250 +7.11% 13
Azerbaijan Azerbaijan 107 -3.21% 55
Belgium Belgium 178 -7.76% 25
Bulgaria Bulgaria 161 +6.64% 30
Bosnia & Herzegovina Bosnia & Herzegovina 123 -1.32% 39
Belarus Belarus 53 -67.9% 65
Brazil Brazil 13.7 +17.3% 76
Botswana Botswana 39.7 -1.84% 67
Canada Canada 21.9 -14.6% 71
Switzerland Switzerland 196 +21.3% 23
China China 332 +24.3% 7
Colombia Colombia 121 +2.75% 42
Cyprus Cyprus 113 +2.2% 47
Czechia Czechia 330 -13.8% 8
Germany Germany 460 +0.534% 3
Denmark Denmark 218 -1.69% 18
Ecuador Ecuador 104 +1.17% 58
Spain Spain 221 -3.25% 16
Estonia Estonia 156 +1.98% 31
Finland Finland 136 -4.91% 34
Fiji Fiji 108 -2.6% 50
France France 258 +1.26% 12
United Kingdom United Kingdom 221 -2.04% 15
Georgia Georgia 107 -4.07% 53
Greece Greece 107 -1.61% 54
Hong Kong SAR China Hong Kong SAR China 128 +0.435% 36
Croatia Croatia 124 +0.914% 38
Hungary Hungary 465 -6.82% 2
Indonesia Indonesia 19.5 +0.657% 73
India India 70.8 +7.99% 62
Ireland Ireland 114 +3.76% 46
Iraq Iraq 2.5 -3.38% 80
Iceland Iceland 119 +1.78% 44
Italy Italy 241 +9.66% 14
Jordan Jordan 107 -5.7% 52
Japan Japan 120 -30.5% 43
Kazakhstan Kazakhstan 176 +7.05% 26
Kyrgyzstan Kyrgyzstan 107 +1.79% 56
South Korea South Korea 23.8 -5.92% 70
Kuwait Kuwait 4.52 0.00000% 79
Lithuania Lithuania 172 +6.97% 28
Luxembourg Luxembourg 108 +0.877% 51
Latvia Latvia 125 -1.38% 37
Morocco Morocco 65.4 +97.9% 63
Moldova Moldova 184 -16.6% 24
Madagascar Madagascar 1.04 -5.44% 82
North Macedonia North Macedonia 387 +44% 4
Malta Malta 269 -7.77% 11
Myanmar (Burma) Myanmar (Burma) 0.137 +242% 84
Mongolia Mongolia 1.43 -31.8% 81
Mauritius Mauritius 86.3 +55.1% 61
Namibia Namibia 61 -14.4% 64
Nicaragua Nicaragua 44.5 -2.31% 66
Netherlands Netherlands 204 +4.77% 21
Norway Norway 122 -10.4% 41
New Zealand New Zealand 218 +5.86% 17
Panama Panama 0.15 -94.5% 83
Peru Peru 166 +6.32% 29
Philippines Philippines 148 -24.2% 33
Poland Poland 215 +5.52% 19
Puerto Rico Puerto Rico 100 0% 60
Portugal Portugal 211 +12.8% 20
Qatar Qatar 101 +0.0508% 59
Romania Romania 379 +10.4% 5
Russia Russia 174 +0.799% 27
Singapore Singapore 14.7 -19.1% 74
Serbia Serbia 151 +5.34% 32
Slovakia Slovakia 512 +50.2% 1
Slovenia Slovenia 293 +14.4% 9
Sweden Sweden 368 +26.2% 6
Thailand Thailand 21.6 -30.2% 72
Turkey Turkey 269 +15.8% 10
Tanzania Tanzania 122 +0.00007% 40
Ukraine Ukraine 111 -12.9% 48
Uruguay Uruguay 119 +0.00746% 45
United States United States 34.8 -5.06% 69
Uzbekistan Uzbekistan 200 +87.1% 22
Vietnam Vietnam 134 +2.9% 35
South Africa South Africa 14.6 0.0000% 75

                    
# 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 = 'NV.MNF.MTRN.ZS.UN'

# 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 <- 'NV.MNF.MTRN.ZS.UN'

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