Prevalence of moderate or severe food insecurity in the population (%)

Source: worldbank.org, 03.09.2025

Year: 2022

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 80.9 +2.28% 7
Angola Angola 79.2 +0.892% 11
Albania Albania 32.2 +6.62% 64
United Arab Emirates United Arab Emirates 10 +2.04% 109
Argentina Argentina 36.1 -2.17% 57
Armenia Armenia 7.8 -2.5% 117
Antigua & Barbuda Antigua & Barbuda 33 0% 62
Australia Australia 12.9 +13.2% 102
Austria Austria 4.9 +14% 132
Azerbaijan Azerbaijan 12.2 +20.8% 105
Burundi Burundi 70.8 17
Belgium Belgium 7.3 +25.9% 119
Benin Benin 63.3 +0.957% 20
Burkina Faso Burkina Faso 40.7 +0.494% 49
Bangladesh Bangladesh 30.5 -1.93% 70
Bulgaria Bulgaria 14.8 -6.33% 97
Bahamas Bahamas 17.2 0% 91
Bosnia & Herzegovina Bosnia & Herzegovina 13.3 -0.746% 100
Belize Belize 45.5 0% 43
Brazil Brazil 18.4 -16.7% 89
Barbados Barbados 31.1 0% 67
Botswana Botswana 54.8 -2.66% 34
Central African Republic Central African Republic 81.3 0% 5
Canada Canada 8.5 +10.4% 114
Switzerland Switzerland 2.5 +19% 137
Chile Chile 17.6 -3.3% 90
Côte d’Ivoire Côte d’Ivoire 39.4 -3.9% 52
Cameroon Cameroon 59.6 +1.88% 24
Congo - Kinshasa Congo - Kinshasa 80.2 +5.67% 8
Congo - Brazzaville Congo - Brazzaville 79.9 0% 9
Colombia Colombia 30.7 -2.85% 69
Comoros Comoros 79.7 0% 10
Cape Verde Cape Verde 34.3 -1.44% 60
Costa Rica Costa Rica 16.2 0% 94
Czechia Czechia 10 +17.6% 109
Germany Germany 4 +5.26% 135
Djibouti Djibouti 49.2 0% 40
Dominica Dominica 34.4 0% 59
Denmark Denmark 7.1 +4.41% 121
Dominican Republic Dominican Republic 46.1 -11.5% 42
Algeria Algeria 18.9 -2.58% 88
Ecuador Ecuador 36.9 -1.07% 55
Egypt Egypt 29.8 +4.56% 71
Spain Spain 6.9 -13.8% 123
Estonia Estonia 9.3 +9.41% 110
Ethiopia Ethiopia 59 +1.55% 25
Finland Finland 12.6 +20% 103
Fiji Fiji 29.2 +20.7% 73
France France 7.9 +19.7% 116
United Kingdom United Kingdom 5.7 +39% 128
Georgia Georgia 32.4 -11.2% 63
Ghana Ghana 42.4 +9.28% 47
Gambia Gambia 59 -2.8% 25
Guinea-Bissau Guinea-Bissau 62.5 +0.16% 21
Greece Greece 6.4 +1.59% 125
Grenada Grenada 19.9 -5.69% 85
Guatemala Guatemala 59.8 0% 23
Guyana Guyana 25.5 0% 77
Honduras Honduras 56 -0.178% 31
Croatia Croatia 7.9 -18.6% 116
Haiti Haiti 82.8 +0.242% 3
Hungary Hungary 15 +19% 96
Indonesia Indonesia 4.9 0% 132
Ireland Ireland 4.2 -22.2% 134
Iran Iran 39.9 -2.21% 51
Iceland Iceland 7 +14.8% 122
Italy Italy 2 -9.09% 139
Jamaica Jamaica 55.1 +1.29% 33
Japan Japan 5.5 +25% 129
Kazakhstan Kazakhstan 2.2 -8.33% 138
Kenya Kenya 72.8 +0.692% 14
Kyrgyzstan Kyrgyzstan 7 +1.45% 122
Cambodia Cambodia 50.5 -1.17% 38
Kiribati Kiribati 41 0% 48
St. Kitts & Nevis St. Kitts & Nevis 29.8 0% 71
South Korea South Korea 5.7 +1.79% 128
Kuwait Kuwait 8.7 -20.2% 113
Laos Laos 36.3 +6.45% 56
Lebanon Lebanon 40.1 +9.86% 50
Liberia Liberia 81 -0.246% 6
Libya Libya 37.9 -4.77% 53
St. Lucia St. Lucia 22.2 0% 81
Sri Lanka Sri Lanka 11.4 +4.59% 106
Lesotho Lesotho 56.7 0% 30
Lithuania Lithuania 6.1 -28.2% 126
Luxembourg Luxembourg 2.6 -3.7% 136
Latvia Latvia 10.2 +8.51% 108
Moldova Moldova 24.7 +5.11% 78
Madagascar Madagascar 68.6 +5.7% 19
Maldives Maldives 13.4 0% 99
Mexico Mexico 20.7 -11.9% 82
North Macedonia North Macedonia 20.2 -15.8% 83
Mali Mali 20 -2.91% 84
Malta Malta 8.2 +13.9% 115
Myanmar (Burma) Myanmar (Burma) 32 +9.22% 65
Montenegro Montenegro 12.3 -4.65% 104
Mongolia Mongolia 5.3 -7.02% 131
Mauritania Mauritania 61.2 +14% 22
Mauritius Mauritius 31.2 -2.5% 66
Malawi Malawi 81.7 -0.85% 4
Malaysia Malaysia 16.7 +4.38% 92
Namibia Namibia 56.8 -1.56% 29
Niger Niger 50.3 +0.199% 39
Nigeria Nigeria 73.9 +6.03% 13
Netherlands Netherlands 5.5 +22.2% 129
Norway Norway 6.8 +30.8% 124
Nepal Nepal 37 -1.07% 54
New Zealand New Zealand 16.4 +8.61% 93
Pakistan Pakistan 44.9 +6.15% 44
Peru Peru 51.7 -0.193% 37
Philippines Philippines 44.1 -1.34% 45
Papua New Guinea Papua New Guinea 57.3 0% 27
Poland Poland 5.4 -28% 130
Portugal Portugal 12.3 -0.806% 104
Paraguay Paraguay 26.2 +1.16% 76
Romania Romania 19.1 +17.2% 87
Russia Russia 4.6 -4.17% 133
Senegal Senegal 29.4 -2.97% 72
Singapore Singapore 7.7 +16.7% 118
Sierra Leone Sierra Leone 88.6 -0.673% 1
El Salvador El Salvador 46.9 -3.1% 41
Somalia Somalia 79.7 +0.252% 10
Serbia Serbia 13 -12.2% 101
South Sudan South Sudan 87.3 0% 2
São Tomé & Príncipe São Tomé & Príncipe 54.6 0% 35
Suriname Suriname 35.8 0% 58
Slovakia Slovakia 9 +8.43% 112
Slovenia Slovenia 7.9 +12.9% 116
Sweden Sweden 6 +11.1% 127
Eswatini Eswatini 55.9 -3.12% 32
Seychelles Seychelles 14.3 -2.72% 98
Chad Chad 76.6 +1.32% 12
Togo Togo 57 +1.79% 28
Thailand Thailand 7.2 +1.41% 120
Tajikistan Tajikistan 28 -9.68% 74
Timor-Leste Timor-Leste 53.7 0% 36
Tonga Tonga 14.8 -15.9% 97
Trinidad & Tobago Trinidad & Tobago 43.3 0% 46
Tunisia Tunisia 26.7 -6.32% 75
Tanzania Tanzania 58.2 -0.852% 26
Uganda Uganda 71.2 -4.04% 16
Ukraine Ukraine 31 +9.93% 68
Uruguay Uruguay 15.7 +3.29% 95
United States United States 9.1 +5.81% 111
St. Vincent & Grenadines St. Vincent & Grenadines 33.3 0% 61
Vietnam Vietnam 10.8 +20% 107
Vanuatu Vanuatu 23.3 0% 80
Samoa Samoa 23.6 0% 79
Yemen Yemen 72.5 +7.89% 15
South Africa South Africa 19.4 +1.04% 86
Zimbabwe Zimbabwe 70.7 -3.94% 18

                    
# 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 = 'SN.ITK.MSFI.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 <- 'SN.ITK.MSFI.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))