Domestic general government health expenditure (% of GDP)

Source: worldbank.org, 03.09.2025

Year: 2022

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 0.181 -74.5% 189
Angola Angola 1.51 -11.6% 151
Albania Albania 2.8 -4.68% 103
Andorra Andorra 5.54 -10.2% 44
United Arab Emirates United Arab Emirates 2.77 -18.6% 106
Argentina Argentina 5.76 -6.18% 42
Armenia Armenia 1.72 -21.6% 142
Antigua & Barbuda Antigua & Barbuda 3.29 +4.58% 88
Australia Australia 7.36 -7.16% 21
Austria Austria 8.64 -8.95% 11
Azerbaijan Azerbaijan 1.21 -18.5% 158
Burundi Burundi 1.59 -28.8% 146
Belgium Belgium 8.09 -4.51% 14
Benin Benin 0.516 +62.2% 186
Burkina Faso Burkina Faso 2.72 -0.73% 108
Bangladesh Bangladesh 0.155 -61.3% 191
Bulgaria Bulgaria 4.79 -13.6% 57
Bahrain Bahrain 2.49 -13.1% 117
Bahamas Bahamas 4.07 +7.35% 77
Bosnia & Herzegovina Bosnia & Herzegovina 5.73 -12.1% 43
Belarus Belarus 4.5 -7.69% 66
Belize Belize 2.64 -25.1% 112
Bolivia Bolivia 5.89 +0.0818% 40
Brazil Brazil 4.1 -4.69% 74
Barbados Barbados 2.83 -34.2% 101
Brunei Brunei 1.68 -16% 143
Bhutan Bhutan 2.15 +4.43% 125
Botswana Botswana 4.3 -11% 70
Central African Republic Central African Republic 1.59 +26% 145
Canada Canada 8 -11.7% 15
Switzerland Switzerland 4.09 -4.9% 75
Chile Chile 5.07 -2.38% 49
China China 2.95 +1.22% 97
Côte d’Ivoire Côte d’Ivoire 1.34 -15.8% 155
Cameroon Cameroon 0.671 +38.5% 180
Congo - Kinshasa Congo - Kinshasa 0.696 +12.9% 179
Congo - Brazzaville Congo - Brazzaville 0.806 -53.2% 174
Colombia Colombia 5.33 -18.5% 46
Comoros Comoros 0.866 -8.39% 173
Cape Verde Cape Verde 4.28 -20.8% 71
Costa Rica Costa Rica 4.95 -7.47% 51
Cuba Cuba 10.5 -17.1% 3
Cyprus Cyprus 7.11 -7.5% 23
Czechia Czechia 7.46 -8.78% 20
Germany Germany 10.1 -0.764% 5
Djibouti Djibouti 1.03 +34.7% 165
Dominica Dominica 4.51 +11.7% 65
Denmark Denmark 7.96 -12.1% 16
Dominican Republic Dominican Republic 2.67 -18.7% 110
Algeria Algeria 1.72 -40.2% 141
Ecuador Ecuador 4.6 -11.3% 62
Egypt Egypt 1.78 +2.66% 138
Eritrea Eritrea 0.9 +1.51% 170
Spain Spain 7.21 -5.13% 22
Estonia Estonia 5.22 -8.14% 47
Ethiopia Ethiopia 0.721 -26.4% 178
Finland Finland 7.89 -1.33% 17
Fiji Fiji 3.19 -12.8% 91
France France 8.96 -3.83% 10
Micronesia (Federated States of) Micronesia (Federated States of) 1.12 -3.28% 162
Gabon Gabon 1.83 +15.1% 135
United Kingdom United Kingdom 9.18 -9.41% 7
Georgia Georgia 3.06 -31% 95
Ghana Ghana 2.05 -2.31% 129
Guinea Guinea 0.729 +7.03% 177
Gambia Gambia 1.52 -5.18% 149
Guinea-Bissau Guinea-Bissau 1.1 -3.24% 164
Equatorial Guinea Equatorial Guinea 0.765 +12.8% 176
Greece Greece 4.6 -15.5% 63
Grenada Grenada 2 -7.82% 132
Guatemala Guatemala 2.43 +2.99% 119
Guyana Guyana 2.16 -35.7% 124
Honduras Honduras 3.37 -1.84% 86
Croatia Croatia 6.09 -9.58% 36
Haiti Haiti 0.342 -11.8% 187
Hungary Hungary 4.84 -9.25% 55
Indonesia Indonesia 1.39 -36.7% 154
India India 1.29 -4.38% 156
Ireland Ireland 4.73 -7.27% 59
Iran Iran 2.63 -17.5% 113
Iraq Iraq 2.18 -15.7% 123
Iceland Iceland 7.86 -4.1% 18
Israel Israel 4.88 -5.49% 54
Italy Italy 6.72 -3.4% 28
Jamaica Jamaica 5.93 +15.9% 38
Jordan Jordan 2.49 -2.74% 116
Japan Japan 9.82 +3.06% 6
Kazakhstan Kazakhstan 2.3 -10.2% 122
Kenya Kenya 2.02 -9.3% 130
Kyrgyzstan Kyrgyzstan 2.64 -10.7% 111
Cambodia Cambodia 1.17 -20.1% 161
Kiribati Kiribati 8.49 -3.02% 12
St. Kitts & Nevis St. Kitts & Nevis 2.93 -17.5% 99
South Korea South Korea 5.92 +8.97% 39
Kuwait Kuwait 3.72 -25.6% 84
Laos Laos 0.626 -12.9% 182
Lebanon Lebanon 1.96 +40.2% 134
Liberia Liberia 1.29 +16.1% 157
Libya Libya 3.15 -29.6% 92
St. Lucia St. Lucia 2.13 -11.4% 126
Sri Lanka Sri Lanka 1.76 -7.44% 140
Lesotho Lesotho 6.41 +45.1% 31
Lithuania Lithuania 4.73 -9.54% 60
Luxembourg Luxembourg 4.83 -1.88% 56
Latvia Latvia 4.93 -21.9% 52
Morocco Morocco 2.32 +2.88% 121
Monaco Monaco 2.94 -10.7% 98
Moldova Moldova 4.52 -10.7% 64
Madagascar Madagascar 0.937 +27.1% 169
Maldives Maldives 7.54 +5.15% 19
Mexico Mexico 2.97 +0.579% 96
Marshall Islands Marshall Islands 4.42 -15.5% 68
North Macedonia North Macedonia 4.33 -6.67% 69
Mali Mali 1.43 +8.07% 152
Malta Malta 6.38 -8.59% 32
Myanmar (Burma) Myanmar (Burma) 0.575 -40.7% 185
Montenegro Montenegro 6.88 +6.55% 26
Mongolia Mongolia 3.12 -25.9% 94
Mozambique Mozambique 2.71 +7.87% 109
Mauritania Mauritania 1.76 +17.6% 139
Mauritius Mauritius 2.75 -18.2% 107
Malawi Malawi 0.878 -35.5% 172
Malaysia Malaysia 1.98 -19.6% 133
Namibia Namibia 4.24 -3.66% 72
Niger Niger 1.54 -27.6% 147
Nigeria Nigeria 0.619 +14.5% 183
Nicaragua Nicaragua 5.16 -15.2% 48
Netherlands Netherlands 6.92 -10.8% 25
Norway Norway 6.81 -19.2% 27
Nepal Nepal 2.11 +19.2% 127
Nauru Nauru 15.8 +67.8% 1
New Zealand New Zealand 8.15 +5.36% 13
Oman Oman 2.46 -35.4% 118
Pakistan Pakistan 1.11 -0.318% 163
Panama Panama 4.76 -6.26% 58
Peru Peru 3.91 -12.5% 81
Philippines Philippines 2.32 -13% 120
Palau Palau 5.8 -6.53% 41
Papua New Guinea Papua New Guinea 1.53 +31% 148
Poland Poland 4.68 +0.899% 61
Portugal Portugal 6.53 -6.43% 30
Paraguay Paraguay 4.08 -8.54% 76
Palestinian Territories Palestinian Territories 3.93 -7.97% 80
Qatar Qatar 1.79 -27.1% 136
Romania Romania 4.46 -8.77% 67
Russia Russia 4.89 +0.735% 53
Rwanda Rwanda 2.81 -6.13% 102
Saudi Arabia Saudi Arabia 3.62 -20.7% 85
Sudan Sudan 1.19 +55.3% 159
Senegal Senegal 0.896 -25.4% 171
Singapore Singapore 2.77 -11.8% 105
Solomon Islands Solomon Islands 3.32 -3.75% 87
Sierra Leone Sierra Leone 1.51 -21.8% 150
El Salvador El Salvador 6.12 -4.65% 35
San Marino San Marino 6.56 -0.944% 29
Somalia Somalia 0.173 -35.4% 190
Serbia Serbia 5.95 -4.87% 37
South Sudan South Sudan 0.58 -37.5% 184
São Tomé & Príncipe São Tomé & Príncipe 4.12 +22.4% 73
Suriname Suriname 3.88 +20.2% 83
Slovakia Slovakia 6.18 -0.15% 34
Slovenia Slovenia 7.06 +1.6% 24
Sweden Sweden 9.02 -5.57% 9
Eswatini Eswatini 3.24 -11.1% 89
Seychelles Seychelles 3.13 -20.5% 93
Syria Syria 1.41 -18.6% 153
Chad Chad 1.01 +30.1% 166
Togo Togo 0.665 +19.3% 181
Thailand Thailand 3.89 +7.36% 82
Tajikistan Tajikistan 1.79 -7.93% 137
Turkmenistan Turkmenistan 0.799 -15.3% 175
Timor-Leste Timor-Leste 10.3 +42.1% 4
Tonga Tonga 3.97 +9.73% 78
Trinidad & Tobago Trinidad & Tobago 2.87 -13.6% 100
Tunisia Tunisia 3.94 -4.46% 79
Turkey Turkey 2.78 -22.6% 104
Tuvalu Tuvalu 13.3 +31.3% 2
Tanzania Tanzania 0.982 +3.97% 167
Uganda Uganda 0.978 -14.9% 168
Uruguay Uruguay 6.32 -3.45% 33
United States United States 9.1 -6.05% 8
Uzbekistan Uzbekistan 2.5 -17% 115
St. Vincent & Grenadines St. Vincent & Grenadines 3.24 -10.9% 90
Venezuela Venezuela 2.07 +50.2% 128
Vietnam Vietnam 2 +2.12% 131
Vanuatu Vanuatu 1.67 +35.8% 144
Samoa Samoa 5.02 -2.13% 50
Yemen Yemen 0.305 +1.71% 188
South Africa South Africa 5.41 -1.82% 45
Zambia Zambia 2.51 -11.2% 114
Zimbabwe Zimbabwe 1.18 +29.2% 160

                    
# 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.GHED.GD.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 <- 'SH.XPD.GHED.GD.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))