External health expenditure per capita (current US$)

Source: worldbank.org, 03.09.2025

Year: 2022

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 17.2 +8.75% 43
Angola Angola 4.74 +52.6% 104
Albania Albania 14.3 +464% 53
United Arab Emirates United Arab Emirates 0 145
Argentina Argentina 17.2 +30.6% 42
Armenia Armenia 3.46 -34.7% 109
Antigua & Barbuda Antigua & Barbuda 1.65 +64% 119
Australia Australia 0 145
Azerbaijan Azerbaijan 8.84 +861% 79
Burundi Burundi 13.1 +19.6% 57
Belgium Belgium 0.657 132
Benin Benin 10.8 -0.69% 68
Burkina Faso Burkina Faso 11.8 +14.4% 60
Bangladesh Bangladesh 11.3 +153% 65
Bahrain Bahrain 0 145
Bahamas Bahamas 10.6 +9.21% 70
Bosnia & Herzegovina Bosnia & Herzegovina 19.4 +319% 39
Belarus Belarus 0.854 -14.8% 129
Belize Belize 13.6 +50.8% 55
Bolivia Bolivia 15.1 +276% 50
Brazil Brazil 0.698 -31.3% 131
Barbados Barbados 8.75 -5.79% 82
Brunei Brunei 0 145
Bhutan Bhutan 23.1 +130% 34
Botswana Botswana 30.3 +14.7% 25
Central African Republic Central African Republic 17 +3% 44
Canada Canada 0 145
Switzerland Switzerland 0 145
Chile Chile 0 145
China China 0.327 +21,232% 138
Côte d’Ivoire Côte d’Ivoire 15.5 +25.8% 49
Cameroon Cameroon 10.3 -5.24% 71
Congo - Kinshasa Congo - Kinshasa 9.42 +16.3% 75
Congo - Brazzaville Congo - Brazzaville 7.67 +41.7% 85
Comoros Comoros 52.6 +106% 13
Cape Verde Cape Verde 23.7 +163% 33
Costa Rica Costa Rica 0.294 -35.2% 139
Cyprus Cyprus 33.5 +19% 21
Djibouti Djibouti 21.1 -45.6% 35
Dominica Dominica 2.55 -95.7% 115
Denmark Denmark 0 145
Dominican Republic Dominican Republic 24.6 +287% 31
Algeria Algeria 0.834 -34.6% 130
Ecuador Ecuador 1.58 -26.3% 120
Egypt Egypt 2.6 +133% 113
Eritrea Eritrea 6.08 -24.2% 94
Estonia Estonia 0.213 -24.5% 141
Ethiopia Ethiopia 6.85 -7.08% 90
Finland Finland 0 145
Fiji Fiji 15 -32.9% 51
Micronesia (Federated States of) Micronesia (Federated States of) 306 -4% 3
Gabon Gabon 8.78 -2.83% 81
United Kingdom United Kingdom 0.5 -2.57% 136
Georgia Georgia 2.06 -24% 116
Ghana Ghana 13 -6.83% 58
Guinea Guinea 11.4 +14.1% 64
Gambia Gambia 6.99 +65.1% 89
Guinea-Bissau Guinea-Bissau 12 -24.8% 59
Equatorial Guinea Equatorial Guinea 1.57 +52.5% 121
Greece Greece 3.77 +54.1% 106
Grenada Grenada 9.62 -46.7% 74
Guatemala Guatemala 8.1 +1.8% 83
Guyana Guyana 17.3 +214% 41
Honduras Honduras 8.83 -30.1% 80
Croatia Croatia 0.119 -17.7% 142
Haiti Haiti 16.2 -20.6% 47
Hungary Hungary 0 145
Indonesia Indonesia 1.26 -61.4% 123
India India 0.93 +21.6% 126
Iran Iran 1.02 +79.4% 124
Iraq Iraq 3.24 +72.1% 110
Iceland Iceland 0 145
Israel Israel 37 +68.8% 17
Jamaica Jamaica 5.96 +16.8% 96
Jordan Jordan 20.4 -18.8% 37
Japan Japan 0 145
Kazakhstan Kazakhstan 1.01 +178% 125
Kenya Kenya 16.6 -4.46% 46
Kyrgyzstan Kyrgyzstan 6.74 +65% 91
Cambodia Cambodia 10.2 -40.6% 73
Kiribati Kiribati 34.4 -40.6% 20
St. Kitts & Nevis St. Kitts & Nevis 0 145
South Korea South Korea 0 145
Kuwait Kuwait 0 145
Laos Laos 15 -42.5% 52
Lebanon Lebanon 28.6 -12% 26
Liberia Liberia 19.8 +2.19% 38
Libya Libya 5.08 -2.62% 101
St. Lucia St. Lucia 86.7 -0.56% 8
Sri Lanka Sri Lanka 20.9 +203% 36
Lesotho Lesotho 48.6 -5.38% 15
Lithuania Lithuania 11.7 +28.2% 61
Luxembourg Luxembourg 77.9 -10.1% 10
Latvia Latvia 2.98 +15.7% 112
Morocco Morocco 6.22 -22.6% 92
Moldova Moldova 10.2 -28.2% 72
Madagascar Madagascar 5.36 -22.9% 99
Maldives Maldives 32.8 -75.7% 23
Mexico Mexico 0 -100% 145
Marshall Islands Marshall Islands 456 +3.82% 1
Mali Mali 2.58 +3.19% 114
Malta Malta 0 145
Myanmar (Burma) Myanmar (Burma) 7.6 +6.06% 86
Mongolia Mongolia 110 +243% 7
Mozambique Mozambique 26.8 +3.5% 27
Mauritania Mauritania 15.8 +131% 48
Mauritius Mauritius 3.65 -53.8% 107
Malawi Malawi 25.6 -10.1% 30
Malaysia Malaysia 0.0196 -2.8% 144
Namibia Namibia 36.2 +8.17% 18
Niger Niger 4.81 -4.86% 103
Nigeria Nigeria 6.15 -4.51% 93
Nicaragua Nicaragua 10.8 +21.9% 69
Netherlands Netherlands 0.599 +10.6% 133
Norway Norway 0 145
Nepal Nepal 9.13 +7.75% 76
Nauru Nauru 254 -26.5% 5
Oman Oman 0 145
Pakistan Pakistan 5.1 +18.7% 100
Panama Panama 6.06 -60.5% 95
Peru Peru 0.917 -9.77% 127
Philippines Philippines 0.568 -94.6% 135
Palau Palau 422 +11.6% 2
Papua New Guinea Papua New Guinea 26.1 +8.06% 29
Poland Poland 0.858 +30% 128
Portugal Portugal 2.03 -24.1% 117
Paraguay Paraguay 0.0607 -95.4% 143
Palestinian Territories Palestinian Territories 48.6 -6.65% 14
Qatar Qatar 0 145
Romania Romania 0 -100% 145
Rwanda Rwanda 33 +51.6% 22
Saudi Arabia Saudi Arabia 0 145
Sudan Sudan 5.59 +162% 98
Senegal Senegal 13.5 +2.63% 56
Singapore Singapore 0 145
Solomon Islands Solomon Islands 26.5 +0.9% 28
Sierra Leone Sierra Leone 11 -4.46% 66
El Salvador El Salvador 5.71 +35.6% 97
Somalia Somalia 7.74 +14.6% 84
South Sudan South Sudan 24.3 +50.7% 32
São Tomé & Príncipe São Tomé & Príncipe 55.7 -31.8% 12
Suriname Suriname 5.06 -30.2% 102
Slovenia Slovenia 4.61 -24.9% 105
Eswatini Eswatini 79.5 +18.9% 9
Seychelles Seychelles 0 145
Syria Syria 7.01 +80.9% 88
Chad Chad 7.52 +78.7% 87
Togo Togo 11.5 +35% 63
Thailand Thailand 0.268 -16.6% 140
Tajikistan Tajikistan 8.85 +1.68% 78
Turkmenistan Turkmenistan 3.62 +313% 108
Timor-Leste Timor-Leste 39.5 -2.56% 16
Tonga Tonga 173 +9.77% 6
Trinidad & Tobago Trinidad & Tobago 0.572 -7.68% 134
Tunisia Tunisia 11.7 +117% 62
Tuvalu Tuvalu 294 -46.5% 4
Tanzania Tanzania 13.8 -20.8% 54
Uganda Uganda 18.4 -28.1% 40
Uruguay Uruguay 0 -100% 145
United States United States 0 145
Uzbekistan Uzbekistan 0.359 +808% 137
St. Vincent & Grenadines St. Vincent & Grenadines 2 -86.9% 118
Venezuela Venezuela 1.47 +90.9% 122
Vietnam Vietnam 2.99 +49.9% 111
Vanuatu Vanuatu 66.8 -25% 11
Samoa Samoa 16.9 -51.6% 45
Yemen Yemen 9.12 +29% 77
South Africa South Africa 10.8 +35.3% 67
Zambia Zambia 31.5 -14.9% 24
Zimbabwe Zimbabwe 35.3 +23.4% 19

                    
# 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 = 'SH.XPD.EHEX.PC.CD'

# 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 <- 'SH.XPD.EHEX.PC.CD'

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