Adolescents out of school (% of lower secondary school age)

Source: worldbank.org, 03.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Albania Albania 5.45 +98.1% 53
Andorra Andorra 2.19 -70.2% 65
United Arab Emirates United Arab Emirates 0.00342 -100% 80
Armenia Armenia 1.83 +338% 66
Azerbaijan Azerbaijan 9.3 -27.9% 40
Burkina Faso Burkina Faso 55.4 +3.04% 4
Bangladesh Bangladesh 15.6 -11.2% 28
Bahrain Bahrain 3.56 +12.6% 60
Bahamas Bahamas 12.6 -9.29% 34
Bosnia & Herzegovina Bosnia & Herzegovina 6.31 +1.05% 49
Belarus Belarus 7.25 +19.7% 46
Belize Belize 6.95 +19.7% 48
Bolivia Bolivia 7.4 -33.9% 45
Barbados Barbados 0.329 -59.8% 76
Brunei Brunei 3.13 +1,871% 61
Côte d’Ivoire Côte d’Ivoire 28.2 -36.8% 18
Cameroon Cameroon 47.7 +0.951% 8
Comoros Comoros 33.3 -15.4% 13
Cuba Cuba 7.05 -7.67% 47
Curaçao Curaçao 0.0274 -97% 79
Cayman Islands Cayman Islands 4.69 -56.7% 54
Dominica Dominica 20.8 +8.89% 23
Dominican Republic Dominican Republic 15.3 +35.9% 29
Algeria Algeria 2.76 -87.4% 63
Ecuador Ecuador 13.6 +396% 32
Ethiopia Ethiopia 51.3 +3.54% 6
Fiji Fiji 1.73 +46.7% 70
Guatemala Guatemala 37.1 -0.837% 11
Guyana Guyana 25 +43.4% 19
Honduras Honduras 42.1 -6.51% 9
Indonesia Indonesia 4.48 -16% 58
India India 14.6 +36.5% 30
Jamaica Jamaica 20 +11.1% 24
Jordan Jordan 4.59 -16.3% 55
Kazakhstan Kazakhstan 1.79 -14.8% 69
Kyrgyzstan Kyrgyzstan 5.97 +5.02% 50
Cambodia Cambodia 10.5 -37.1% 35
Kiribati Kiribati 9.62 -1.29% 39
Laos Laos 35.2 +2.03% 12
Lebanon Lebanon 31.6 15
Lesotho Lesotho 28.8 +4.03% 17
Macao SAR China Macao SAR China 9.77 -5.85% 37
Morocco Morocco 2.39 -46.6% 64
Madagascar Madagascar 37.3 +5.44% 10
Maldives Maldives 1.38 -45.3% 72
Montenegro Montenegro 0.0545 -60.4% 78
Mongolia Mongolia 4.49 +2.91% 57
Malawi Malawi 29.9 -1.4% 16
Malaysia Malaysia 8.69 -21.7% 42
Niger Niger 72.3 +1.26% 1
Nicaragua Nicaragua 17.4 -9.23% 26
Nepal Nepal 3.97 -52.3% 59
Nauru Nauru 9.7 +3.97% 38
Oman Oman 8.13 -41.8% 44
Peru Peru 0.967 -58.3% 75
Philippines Philippines 9.14 -18.6% 41
Palau Palau 5.54 -50.1% 52
Puerto Rico Puerto Rico 13.8 +114% 31
Paraguay Paraguay 17 -6.53% 27
Palestinian Territories Palestinian Territories 5.77 +14.4% 51
Russia Russia 0.275 -4.76% 77
Rwanda Rwanda 4.54 -1.84% 56
Senegal Senegal 64.6 +4.63% 2
Solomon Islands Solomon Islands 18.1 +1.67% 25
El Salvador El Salvador 22 -0.0989% 22
San Marino San Marino 8.66 +11.8% 43
Seychelles Seychelles 1.8 -18.5% 68
Syria Syria 52.1 -1.54% 5
Turks & Caicos Islands Turks & Caicos Islands 10.4 -21.7% 36
Chad Chad 56.9 -3.05% 3
Togo Togo 24.8 +34.4% 20
Tonga Tonga 1.15 +2,028% 74
Trinidad & Tobago Trinidad & Tobago 32.9 +176% 14
Tuvalu Tuvalu 13.2 +94% 33
Tanzania Tanzania 50.9 +0.749% 7
Uzbekistan Uzbekistan 2.87 -3.18% 62
Venezuela Venezuela 1.81 -89.6% 67
Vietnam Vietnam 1.26 -25.8% 73
Vanuatu Vanuatu 24.1 +361% 21
Samoa Samoa 1.44 +4,008% 71

                    
# 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 = 'SE.SEC.UNER.LO.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 <- 'SE.SEC.UNER.LO.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))