School enrollment, tertiary (% gross)

Source: worldbank.org, 01.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Angola Angola 9.91 -10.4% 63
Albania Albania 64.7 +3.32% 10
Andorra Andorra 64.3 +86.4% 11
United Arab Emirates United Arab Emirates 61.3 +10% 12
Armenia Armenia 61.2 +2.31% 13
Azerbaijan Azerbaijan 41.4 +0.949% 31
Burundi Burundi 6.22 -1.03% 66
Burkina Faso Burkina Faso 10.2 +4.51% 62
Bangladesh Bangladesh 23.8 +4.09% 46
Bahrain Bahrain 72 -6.84% 7
Bosnia & Herzegovina Bosnia & Herzegovina 45 +0.788% 29
Belarus Belarus 67.1 -5.37% 8
Belize Belize 22.7 -4.52% 47
Bermuda Bermuda 17 -25.7% 53
Brunei Brunei 38.3 +14.2% 35
Bhutan Bhutan 15 -14.3% 55
Botswana Botswana 21.8 -2.62% 49
China China 74.8 +3.95% 5
Côte d’Ivoire Côte d’Ivoire 11.1 +4.65% 60
Cameroon Cameroon 15.8 -2.46% 54
Congo - Brazzaville Congo - Brazzaville 10.4 -15.6% 61
Cuba Cuba 48.9 +18% 22
Algeria Algeria 55.5 +3.97% 18
Egypt Egypt 39.4 +4.14% 33
Fiji Fiji 60.3 -11.8% 14
Georgia Georgia 80.3 +1.7% 4
Ghana Ghana 22 +7.85% 48
Guatemala Guatemala 27.3 +45.9% 44
Hong Kong SAR China Hong Kong SAR China 100 +3.2% 2
Indonesia Indonesia 45.1 +5.87% 28
India India 33.1 +1.37% 38
Jordan Jordan 33.1 +1.68% 39
Kazakhstan Kazakhstan 56.5 -4.1% 16
Kyrgyzstan Kyrgyzstan 56 +0.177% 17
Cambodia Cambodia 18 +19.8% 50
Laos Laos 14.9 +8.8% 56
Lebanon Lebanon 60.2 -2.32% 15
Macao SAR China Macao SAR China 129 +11.1% 1
Morocco Morocco 47.7 +3.31% 23
Madagascar Madagascar 6.41 +4.17% 65
Montenegro Montenegro 55.2 -3.93% 19
Mongolia Mongolia 65.3 +1.55% 9
Malaysia Malaysia 41.3 +2.46% 32
Nicaragua Nicaragua 29.5 +52.8% 42
Nepal Nepal 17.8 +27.3% 51
Oman Oman 45.6 +3.98% 26
Pakistan Pakistan 11.2 +5.65% 59
Philippines Philippines 45.3 +14.4% 27
Palau Palau 34.6 -14.6% 37
Puerto Rico Puerto Rico 82 -19.7% 3
Palestinian Territories Palestinian Territories 42.9 -4.61% 30
Rwanda Rwanda 8.89 +19.9% 64
Senegal Senegal 17.3 +2.9% 52
El Salvador El Salvador 32.2 +3.02% 40
San Marino San Marino 51.1 -4.95% 21
Serbia Serbia 73.2 +1.63% 6
Sint Maarten Sint Maarten 3.66 +8.31% 68
Seychelles Seychelles 14 +0.745% 57
Turks & Caicos Islands Turks & Caicos Islands 25.3 +48% 45
Thailand Thailand 46.2 +5.04% 24
Tajikistan Tajikistan 34.7 -9.59% 36
Timor-Leste Timor-Leste 30.8 +75.3% 41
Tonga Tonga 51.2 +141% 20
Tunisia Tunisia 38.5 +1.71% 34
Tanzania Tanzania 5.22 -3.93% 67
Uzbekistan Uzbekistan 45.8 +46.5% 25
British Virgin Islands British Virgin Islands 29.4 -6.17% 43
Samoa Samoa 13.4 -21.3% 58

                    
# 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.TER.ENRR'

# 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.TER.ENRR'

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