Employment to population ratio, ages 15-24, male (%)

Source: worldbank.org, 19.12.2024

Year: 2023

Flag Country Value Value change, % Rank
United Arab Emirates United Arab Emirates 58.8 +25.9% 11
Argentina Argentina 36.3 +2.7% 48
Australia Australia 64.3 +0.593% 5
Austria Austria 53.7 +0.855% 17
Belgium Belgium 27.1 +1.97% 71
Burkina Faso Burkina Faso 27.9 -53.5% 67
Bulgaria Bulgaria 21.2 -9.05% 80
Bahamas Bahamas 78.1 +52.8% 1
Bosnia & Herzegovina Bosnia & Herzegovina 24.6 -5.24% 75
Belarus Belarus 36.1 -6.76% 49
Bolivia Bolivia 61.9 -0.543% 7
Brazil Brazil 51 -1.01% 22
Brunei Brunei 36.4 -0.685% 46
Bhutan Bhutan 27.2 +17.5% 69
Botswana Botswana 27.1 +4.34% 70
Canada Canada 57.4 +0.0907% 13
Switzerland Switzerland 63 +0.0794% 6
Chile Chile 26.9 -2.63% 72
Colombia Colombia 43.1 +0.982% 37
Costa Rica Costa Rica 33.3 -6.94% 54
Cyprus Cyprus 36.5 +2.88% 45
Czechia Czechia 29.2 -2.46% 65
Germany Germany 52.8 +1.87% 19
Denmark Denmark 55.9 -0.102% 14
Dominican Republic Dominican Republic 51.1 +1.21% 21
Ecuador Ecuador 49.4 -2.44% 24
Spain Spain 25 +2.38% 74
Estonia Estonia 33.4 +2.33% 53
Finland Finland 43.9 -3.75% 35
France France 35.3 +2.07% 51
United Kingdom United Kingdom 47.2 -0.473% 27
Gambia Gambia 30 -19.3% 61
Greece Greece 20.2 +6.48% 81
Guatemala Guatemala 75.5 +11.1% 3
Hong Kong SAR China Hong Kong SAR China 27.3 -1.47% 68
Honduras Honduras 60.9 -3.68% 9
Croatia Croatia 30.7 -9.95% 60
Hungary Hungary 30.7 +1.77% 59
Indonesia Indonesia 46.7 +4.37% 28
India India 37.8 +5.57% 41
Ireland Ireland 47.9 +3.6% 26
Iceland Iceland 68 +0.103% 4
Israel Israel 46.1 +4.42% 30
Italy Italy 24.3 +3.93% 77
Jamaica Jamaica 37.7 +7.32% 42
Japan Japan 46.5 +2.97% 29
South Korea South Korea 21.6 -5.98% 79
Lithuania Lithuania 29.8 -5.65% 62
Luxembourg Luxembourg 32 +20.3% 56
Latvia Latvia 31.7 +0.948% 58
Moldova Moldova 35.8 -5.21% 50
Mexico Mexico 52.8 -0.0473% 18
North Macedonia North Macedonia 24.4 -3.42% 76
Malta Malta 50.5 -1.02% 23
Mongolia Mongolia 33.1 -2.52% 55
Mauritius Mauritius 40 +19.5% 39
Netherlands Netherlands 76.8 +1.4% 2
Norway Norway 57.8 +2.48% 12
New Zealand New Zealand 61.7 +0.84% 8
Panama Panama 44.5 -6.74% 34
Peru Peru 55 -6.25% 16
Poland Poland 32 -0.43% 57
Portugal Portugal 29.5 +8.17% 63
Paraguay Paraguay 60.5 +4.57% 10
Romania Romania 23.4 -5.4% 78
Russia Russia 28.7 +3.72% 66
Rwanda Rwanda 40.4 +20.1% 38
Saudi Arabia Saudi Arabia 37.6 +12.8% 43
Singapore Singapore 34.6 -7.75% 52
El Salvador El Salvador 55.4 -4.66% 15
Serbia Serbia 29.4 -1.26% 64
Slovakia Slovakia 25.4 -4.16% 73
Slovenia Slovenia 36.4 +3.43% 47
Sweden Sweden 44.8 -1.99% 33
Seychelles Seychelles 43.1 +2.57% 36
Thailand Thailand 45 +3.11% 32
Tunisia Tunisia 19 -5.31% 82
Turkey Turkey 49.2 +4.79% 25
Uruguay Uruguay 36.8 -2.48% 44
United States United States 51.6 +0.169% 20
Vietnam Vietnam 39.6 -8.57% 40
South Africa South Africa 12.5 +5.33% 83
Zimbabwe Zimbabwe 45.4 +7.72% 31

                    
# 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 = 'SL.EMP.1524.SP.MA.NE.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 <- 'SL.EMP.1524.SP.MA.NE.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))