Intentional homicides (per 100,000 people)

Source: worldbank.org, 01.09.2025

Year: 2021

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 4.02 -39% 42
Albania Albania 2.31 +8.66% 54
United Arab Emirates United Arab Emirates 0.47 -32.9% 93
Argentina Argentina 4.62 -13.9% 41
Armenia Armenia 2.19 +17.9% 55
Antigua & Barbuda Antigua & Barbuda 17.2 +76.7% 16
Australia Australia 0.745 -13.5% 81
Austria Austria 0.729 -0.16% 82
Azerbaijan Azerbaijan 1.91 -14.6% 60
Belgium Belgium 1.08 -65.1% 69
Bulgaria Bulgaria 1.28 +29.3% 65
Bahrain Bahrain 0.0683 104
Bahamas Bahamas 29.2 +62.4% 9
Bosnia & Herzegovina Bosnia & Herzegovina 0.978 -24.5% 73
Belize Belize 31.2 +21% 5
Bermuda Bermuda 10.9 -0.241% 27
Bolivia Bolivia 3.49 -0.00158% 47
Barbados Barbados 11.4 -22.1% 25
Botswana Botswana 10.5 +21.5% 28
Canada Canada 2.07 +3.1% 56
Switzerland Switzerland 0.483 -11.2% 92
Chile Chile 3.63 -24.3% 46
Colombia Colombia 27.5 +13.4% 12
Costa Rica Costa Rica 11.4 +2.54% 24
Cyprus Cyprus 1.29 +6.1% 64
Czechia Czechia 0.447 -38.8% 94
Germany Germany 0.833 -11.2% 76
Dominica Dominica 13.8 -33.7% 19
Denmark Denmark 0.803 -15% 78
Dominican Republic Dominican Republic 10.5 +20.7% 29
Algeria Algeria 1.57 +4.52% 62
Ecuador Ecuador 14 +79.8% 18
Spain Spain 0.611 -2.94% 87
Estonia Estonia 1.96 -38.1% 57
France France 1.14 +5.98% 67
Ghana Ghana 1.84 +6.49% 61
Greece Greece 0.852 +14.8% 75
Grenada Grenada 4.01 -64.6% 43
Guatemala Guatemala 20 +5.43% 13
Guyana Guyana 16.3 -17.3% 17
Hong Kong SAR China Hong Kong SAR China 0.307 +4.63% 100
Honduras Honduras 38.3 +7.12% 4
Croatia Croatia 0.813 -16.8% 77
Haiti Haiti 13 +14.9% 20
Hungary Hungary 0.772 -5.86% 80
India India 2.94 +0.863% 49
Ireland Ireland 0.441 -33.9% 95
Iceland Iceland 0.54 -60.4% 88
Israel Israel 1.94 +36.2% 58
Italy Italy 0.511 +6.78% 91
Jamaica Jamaica 52.1 +10.3% 1
Jordan Jordan 1.02 +3.48% 71
Japan Japan 0.229 -9.92% 102
Kenya Kenya 5.27 +47.5% 38
St. Kitts & Nevis St. Kitts & Nevis 29.4 +40.1% 7
South Korea South Korea 0.521 -12.3% 90
St. Lucia St. Lucia 39 +34.3% 3
Liechtenstein Liechtenstein 5.12 +98.5% 39
Lithuania Lithuania 2.58 -27.9% 51
Luxembourg Luxembourg 0.626 +31.5% 86
Latvia Latvia 3.04 -17.6% 48
Macao SAR China Macao SAR China 0.437 +47.7% 96
Morocco Morocco 1.93 +54.7% 59
Mexico Mexico 28.2 -3.46% 11
Malta Malta 0.38 -72% 98
Myanmar (Burma) Myanmar (Burma) 28.4 +867% 10
Montenegro Montenegro 2.39 -16.5% 53
Mongolia Mongolia 6.15 -1.12% 35
Mauritius Mauritius 2.62 -2.94% 50
Malaysia Malaysia 0.724 -5.02% 83
Namibia Namibia 12.4 +2.27% 23
Nicaragua Nicaragua 11 +42.4% 26
Netherlands Netherlands 0.651 +6.13% 85
Norway Norway 0.537 -6.85% 89
Oman Oman 0.243 -21% 101
Pakistan Pakistan 3.98 +6.47% 44
Panama Panama 12.7 +9.35% 21
Poland Poland 0.713 +2.95% 84
Portugal Portugal 0.797 +1.31% 79
Paraguay Paraguay 7.83 +7.76% 32
Palestinian Territories Palestinian Territories 0.877 -8.33% 74
Qatar Qatar 0.335 -23% 99
Romania Romania 1.26 -12.7% 66
Russia Russia 6.8 -7.44% 34
Singapore Singapore 0.101 -40.3% 103
El Salvador El Salvador 18.2 -14.8% 15
Serbia Serbia 1.06 -7.56% 70
Suriname Suriname 5.71 -37% 37
Slovakia Slovakia 1.01 -12.6% 72
Slovenia Slovenia 0.425 -18.3% 97
Sweden Sweden 1.08 -9.73% 68
Eswatini Eswatini 12.7 +12.2% 22
Seychelles Seychelles 4.7 -44.9% 40
Trinidad & Tobago Trinidad & Tobago 29.4 +11.7% 8
Turkey Turkey 2.52 +0.563% 52
Uganda Uganda 8.53 -15.1% 31
Ukraine Ukraine 3.84 -0.616% 45
Uruguay Uruguay 8.9 -9.69% 30
United States United States 6.81 +6.02% 33
Uzbekistan Uzbekistan 1.41 +4.94% 63
St. Vincent & Grenadines St. Vincent & Grenadines 30.7 -2.75% 6
Venezuela Venezuela 19.3 -34.4% 14
South Africa South Africa 41.9 +23.3% 2
Zimbabwe Zimbabwe 6.14 +23.3% 36

                    
# 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 = 'VC.IHR.PSRC.P5'

# 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 <- 'VC.IHR.PSRC.P5'

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