School enrollment, tertiary (gross), gender parity index (GPI)

Source: worldbank.org, 03.09.2025

Year: 2023

Flag Country Value Value change, % Rank
Angola Angola 0.976 +8.54% 55
Albania Albania 1.32 -0.636% 23
Andorra Andorra 1.16 +12.1% 39
United Arab Emirates United Arab Emirates 1.23 +17.1% 32
Armenia Armenia 1.27 +2.35% 28
Azerbaijan Azerbaijan 1.19 +2.65% 36
Burundi Burundi 0.777 +0.0785% 63
Burkina Faso Burkina Faso 0.677 +8.36% 66
Bangladesh Bangladesh 0.859 +2.18% 60
Bahrain Bahrain 1.34 +0.719% 19
Bosnia & Herzegovina Bosnia & Herzegovina 1.38 +0.357% 13
Belarus Belarus 1.12 +0.901% 44
Belize Belize 1.45 -0.188% 6
Bermuda Bermuda 1.33 +3.13% 21
Brunei Brunei 1.31 -3.98% 24
Bhutan Bhutan 0.988 -4.15% 53
Botswana Botswana 1.39 -0.412% 11
China China 1.14 -0.32% 42
Côte d’Ivoire Côte d’Ivoire 0.876 +8.73% 59
Cameroon Cameroon 0.829 +2.97% 61
Congo - Brazzaville Congo - Brazzaville 0.67 +0.171% 67
Cuba Cuba 1.47 -2.31% 4
Algeria Algeria 1.35 -5.3% 16
Egypt Egypt 1 -0.674% 52
Fiji Fiji 1.3 -0.749% 25
Georgia Georgia 1.16 +1.42% 40
Ghana Ghana 0.964 +2.42% 56
Guatemala Guatemala 1.21 +10.1% 33
Hong Kong SAR China Hong Kong SAR China 1.09 +1.91% 45
Indonesia Indonesia 1.2 +1.38% 35
India India 0.982 -4.95% 54
Jordan Jordan 1.34 -0.692% 18
Kazakhstan Kazakhstan 1.18 -0.829% 38
Kyrgyzstan Kyrgyzstan 1.18 +3.61% 37
Cambodia Cambodia 1.14 +28.8% 43
Laos Laos 0.751 -27.2% 65
Macao SAR China Macao SAR China 1.08 -1.02% 46
Morocco Morocco 1.15 +2.57% 41
Madagascar Madagascar 1.02 +0.186% 51
Montenegro Montenegro 1.34 +3.26% 17
Mongolia Mongolia 1.39 -0.336% 10
Malaysia Malaysia 1.26 +1.41% 29
Nicaragua Nicaragua 1.29 +2.13% 27
Nepal Nepal 1.2 +8.23% 34
Oman Oman 1.35 +2.18% 15
Pakistan Pakistan 0.959 +0.531% 57
Philippines Philippines 1.3 -1.65% 26
Palau Palau 1.33 +10.8% 20
Puerto Rico Puerto Rico 1.36 +7.36% 14
Palestinian Territories Palestinian Territories 1.4 +1.55% 9
Rwanda Rwanda 0.77 +1.39% 64
Senegal Senegal 1.04 +6.71% 49
El Salvador El Salvador 1.26 +0.0898% 30
San Marino San Marino 0.896 +7.16% 58
Serbia Serbia 1.32 +1.51% 22
Sint Maarten Sint Maarten 1.78 -0.889% 1
Seychelles Seychelles 1.46 -4.17% 5
Turks & Caicos Islands Turks & Caicos Islands 1.52 -4.67% 3
Thailand Thailand 1.26 +0.226% 31
Tajikistan Tajikistan 1.08 +18.2% 48
Timor-Leste Timor-Leste 1.08 +49.1% 47
Tonga Tonga 1.4 -8.96% 8
Tunisia Tunisia 1.43 +0.789% 7
Tanzania Tanzania 0.82 +0.449% 62
Uzbekistan Uzbekistan 1.03 +16.7% 50
British Virgin Islands British Virgin Islands 1.39 -2% 12
Samoa Samoa 1.62 +7.11% 2

                    
# 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.ENR.TERT.FM.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.ENR.TERT.FM.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))