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

Source: worldbank.org, 19.12.2024

Year: 2023

Flag Country Value Value change, % Rank
United Arab Emirates United Arab Emirates 46.9 +24.4% 21
Argentina Argentina 32.1 +4.27% 50
Australia Australia 64.9 -0.684% 4
Austria Austria 51.8 +2.02% 12
Belgium Belgium 26.5 +2.02% 63
Burkina Faso Burkina Faso 25.5 -53% 69
Bulgaria Bulgaria 18.8 -5.41% 79
Bahamas Bahamas 79.6 +66.2% 1
Bosnia & Herzegovina Bosnia & Herzegovina 18.9 -5.53% 77
Belarus Belarus 34.9 -7.2% 44
Bolivia Bolivia 57.7 -0.107% 9
Brazil Brazil 44.7 -0.0425% 26
Brunei Brunei 29.2 -5% 53
Bhutan Bhutan 26.4 +26.2% 64
Botswana Botswana 22.9 +5.82% 74
Canada Canada 58 -1.24% 8
Switzerland Switzerland 61.5 -0.153% 5
Chile Chile 23.6 -2.8% 73
Colombia Colombia 36.1 +2.66% 40
Costa Rica Costa Rica 28.7 -3.92% 55
Cyprus Cyprus 36.5 +5.88% 38
Czechia Czechia 25.5 -1.29% 68
Germany Germany 50.8 +1.3% 15
Denmark Denmark 57 +1.6% 11
Dominican Republic Dominican Republic 42 +5.41% 30
Ecuador Ecuador 40 -3.64% 33
Spain Spain 23.6 +2.68% 72
Estonia Estonia 36.1 -1.16% 39
Finland Finland 45.9 -0.843% 22
France France 33.5 +1.36% 46
United Kingdom United Kingdom 47.3 -2.73% 20
Gambia Gambia 27.6 -28.1% 59
Greece Greece 18.3 +13.7% 81
Guatemala Guatemala 57.4 +19.1% 10
Hong Kong SAR China Hong Kong SAR China 27.9 -1.87% 58
Honduras Honduras 44.8 -4.08% 25
Croatia Croatia 25.3 -11.8% 70
Hungary Hungary 27.4 -0.693% 60
Indonesia Indonesia 40.1 +3.24% 32
India India 26.8 +12.9% 61
Ireland Ireland 48.2 +2.11% 18
Iceland Iceland 71.7 +0.705% 3
Israel Israel 45.5 +3.11% 23
Italy Italy 20.4 +2.9% 76
Jamaica Jamaica 34.2 +7.74% 45
Japan Japan 47.8 +2.65% 19
South Korea South Korea 25.8 -4.45% 66
Lithuania Lithuania 30.8 -3.57% 51
Luxembourg Luxembourg 29 +5.17% 54
Latvia Latvia 30.6 +0.0719% 52
Moldova Moldova 35 -4.39% 43
Mexico Mexico 42.1 +1.73% 29
North Macedonia North Macedonia 18.9 -1.49% 78
Malta Malta 49.8 -3.95% 16
Mongolia Mongolia 25.6 -12.1% 67
Mauritius Mauritius 35.3 +26.4% 42
Netherlands Netherlands 76.5 +1.27% 2
Norway Norway 58.5 +1.18% 7
New Zealand New Zealand 61.3 +0.15% 6
Panama Panama 35.6 -3.87% 41
Peru Peru 51.2 -6.38% 14
Poland Poland 28.6 +2.6% 56
Portugal Portugal 28.2 +11.9% 57
Paraguay Paraguay 49.6 +3.77% 17
Romania Romania 18.7 -5.16% 80
Russia Russia 25.9 +4.04% 65
Rwanda Rwanda 37 +19.2% 37
Saudi Arabia Saudi Arabia 26.5 +14% 62
Singapore Singapore 33.2 -3.88% 47
El Salvador El Salvador 42.7 -2.08% 27
Serbia Serbia 24 -1.58% 71
Slovakia Slovakia 21.7 +1.93% 75
Slovenia Slovenia 32.6 +1.09% 48
Sweden Sweden 44.8 +0.555% 24
Seychelles Seychelles 42.6 -2.96% 28
Thailand Thailand 38.7 +4.19% 34
Tunisia Tunisia 14.3 -7.57% 82
Turkey Turkey 37.6 +6.46% 36
Uruguay Uruguay 32.5 -3.66% 49
United States United States 51.8 +1.44% 13
Vietnam Vietnam 38.6 -6.69% 35
South Africa South Africa 10.8 +8.52% 83
Zimbabwe Zimbabwe 40.7 +7.98% 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.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.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))