Physicians (per 1,000 people)

Source: worldbank.org, 03.09.2025

Year: 2021

Flag Country Value Value change, % Rank
United Arab Emirates United Arab Emirates 2.91 +1.15% 42
Australia Australia 3.98 +1.92% 19
Austria Austria 5.43 +1.99% 4
Burundi Burundi 0.065 -7.14% 96
Belgium Belgium 3.24 +1.03% 38
Benin Benin 0.212 +242% 85
Burkina Faso Burkina Faso 0.101 +5.21% 92
Bangladesh Bangladesh 0.67 +2.13% 75
Bulgaria Bulgaria 4.29 +0.965% 14
Bolivia Bolivia 1.27 +33.3% 67
Brazil Brazil 2.14 -6.99% 58
Barbados Barbados 2.88 +9.71% 43
Brunei Brunei 1.91 +7.59% 62
Bhutan Bhutan 0.56 +15.7% 76
Botswana Botswana 0.392 -2.49% 80
Central African Republic Central African Republic 0.021 -68.2% 100
Canada Canada 2.46 +1.27% 52
Switzerland Switzerland 4.44 +1.23% 11
Chile Chile 2.97 +5.88% 40
China China 2.52 +5.49% 50
Côte d’Ivoire Côte d’Ivoire 0.18 +9.09% 86
Cameroon Cameroon 0.124 +27.8% 90
Congo - Kinshasa Congo - Kinshasa 0.177 +5.99% 87
Colombia Colombia 2.45 +3.03% 53
Costa Rica Costa Rica 2.52 +2.73% 50
Cuba Cuba 9.43 +2.62% 1
Cyprus Cyprus 3.55 +5.59% 26
Czechia Czechia 4.25 +2.26% 16
Germany Germany 4.52 +1.32% 7
Dominican Republic Dominican Republic 2.03 +4.16% 60
Eritrea Eritrea 0.079 -3.66% 95
Spain Spain 4.48 -2.12% 10
Estonia Estonia 3.44 -1.21% 29
Ethiopia Ethiopia 0.101 -2.88% 92
Finland Finland 4.38 +21.3% 13
France France 3.34 +0.602% 33
United Kingdom United Kingdom 3.17 +4.27% 39
Georgia Georgia 5.33 +3.27% 5
Ghana Ghana 0.127 -22.6% 89
Gambia Gambia 0.102 +34.2% 91
Guinea-Bissau Guinea-Bissau 0.22 +15.2% 84
Greece Greece 6.37 +1.13% 2
Croatia Croatia 3.61 -48.1% 24
Hungary Hungary 3.3 +5.07% 35
Indonesia Indonesia 0.695 +10.8% 74
Ireland Ireland 4.06 +16.6% 18
Iraq Iraq 0.972 +6.46% 70
Iceland Iceland 4.41 +2.04% 12
Israel Israel 3.65 +1.95% 23
Italy Italy 4.1 +2.5% 17
Kenya Kenya 0.098 -39.1% 93
Kyrgyzstan Kyrgyzstan 2.15 -1.06% 56
South Korea South Korea 2.52 +0.359% 51
Laos Laos 0.327 -8.4% 81
Liberia Liberia 0.171 +11.8% 88
Sri Lanka Sri Lanka 1.19 -1.65% 68
Lithuania Lithuania 4.5 +1.24% 9
Latvia Latvia 3.38 +0.957% 32
Moldova Moldova 3.25 -20% 36
Mexico Mexico 2.56 +4.83% 49
Malta Malta 4.28 +2.13% 15
Montenegro Montenegro 2.77 +1.17% 47
Mongolia Mongolia 3.87 +2.65% 21
Mozambique Mozambique 0.081 -2.41% 94
Mauritania Mauritania 0.224 +7.69% 83
Malaysia Malaysia 2.32 +3.95% 54
Namibia Namibia 0.467 +12.3% 78
Nigeria Nigeria 0.395 +7.63% 79
Netherlands Netherlands 3.91 +1.48% 20
Norway Norway 5.17 +1.61% 6
Nepal Nepal 0.867 +2.48% 71
New Zealand New Zealand 3.52 +1.97% 27
Oman Oman 2 +0.15% 61
Panama Panama 1.73 +6.45% 63
Peru Peru 1.65 +21% 64
Philippines Philippines 0.786 +4.52% 73
Papua New Guinea Papua New Guinea 0.063 +3.28% 97
Poland Poland 3.39 +3.35% 31
Portugal Portugal 5.77 +2.71% 3
Paraguay Paraguay 3.24 +186% 37
Romania Romania 3.47 +5.25% 28
Saudi Arabia Saudi Arabia 2.79 +5.32% 46
Senegal Senegal 0.101 +20.2% 92
Singapore Singapore 2.6 +3.51% 48
El Salvador El Salvador 2.91 -0.783% 41
Serbia Serbia 2.84 +5.11% 44
Suriname Suriname 1.48 +85.9% 65
Slovakia Slovakia 3.68 +0.272% 22
Slovenia Slovenia 3.33 +1.43% 34
Chad Chad 0.058 -3.33% 99
Togo Togo 0.059 -27.2% 98
Tajikistan Tajikistan 2.13 +0.661% 59
Turkmenistan Turkmenistan 2.14 -1.61% 57
Tonga Tonga 1.01 +6.21% 69
Trinidad & Tobago Trinidad & Tobago 3.41 -18.6% 30
Tunisia Tunisia 1.29 -0.232% 66
Turkey Turkey 2.17 +6.34% 55
Uruguay Uruguay 4.51 -9.13% 8
United States United States 3.61 +1.49% 25
Uzbekistan Uzbekistan 2.81 +0.754% 45
Samoa Samoa 0.548 -1.08% 77
South Africa South Africa 0.809 +1.25% 72
Zambia Zambia 0.297 +16.5% 82

                    
# 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.MED.PHYS.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.MED.PHYS.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))