Average precipitation in depth (mm per year)

Source: worldbank.org, 01.09.2025

Year: 2021

Flag Country Value Value change, % Rank
Afghanistan Afghanistan 327 0% 149
Angola Angola 1,010 0% 93
Albania Albania 1,485 0% 59
United Arab Emirates United Arab Emirates 78 0% 170
Argentina Argentina 591 0% 129
Armenia Armenia 562 0% 132
Antigua & Barbuda Antigua & Barbuda 1,030 0% 89
Australia Australia 534 0% 136
Austria Austria 1,110 0% 83
Azerbaijan Azerbaijan 447 0% 143
Burundi Burundi 1,274 0% 70
Belgium Belgium 847 0% 99
Benin Benin 1,039 0% 87
Burkina Faso Burkina Faso 748 0% 106
Bangladesh Bangladesh 2,666 0% 11
Bulgaria Bulgaria 608 0% 126
Bahrain Bahrain 83 0% 169
Bahamas Bahamas 1,292 0% 69
Bosnia & Herzegovina Bosnia & Herzegovina 1,028 0% 90
Belarus Belarus 618 0% 125
Belize Belize 1,705 0% 46
Bolivia Bolivia 1,146 0% 79
Brazil Brazil 1,761 0% 42
Barbados Barbados 1,422 0% 62
Brunei Brunei 2,722 0% 9
Bhutan Bhutan 2,200 0% 24
Botswana Botswana 416 0% 145
Central African Republic Central African Republic 1,343 0% 66
Canada Canada 537 0% 134
Switzerland Switzerland 1,537 0% 55
Chile Chile 1,522 0% 56
China China 645 0% 118
Côte d’Ivoire Côte d’Ivoire 1,348 0% 65
Cameroon Cameroon 1,604 0% 51
Congo - Kinshasa Congo - Kinshasa 1,543 0% 54
Congo - Brazzaville Congo - Brazzaville 1,646 0% 49
Colombia Colombia 3,240 0% 1
Comoros Comoros 900 0% 95
Cape Verde Cape Verde 228 0% 156
Costa Rica Costa Rica 2,926 0% 6
Cuba Cuba 1,335 0% 67
Cyprus Cyprus 498 0% 138
Czechia Czechia 677 0% 112
Germany Germany 700 0% 109
Djibouti Djibouti 220 0% 157
Dominica Dominica 2,083 0% 27
Denmark Denmark 703 0% 108
Dominican Republic Dominican Republic 1,410 0% 64
Algeria Algeria 89 0% 168
Ecuador Ecuador 2,274 0% 23
Egypt Egypt 18.1 0% 174
Eritrea Eritrea 384 0% 147
Spain Spain 636 0% 120
Estonia Estonia 626 0% 122
Ethiopia Ethiopia 848 0% 98
Finland Finland 536 0% 135
Fiji Fiji 2,592 0% 12
France France 867 0% 96
Gabon Gabon 1,831 0% 39
United Kingdom United Kingdom 1,220 0% 71
Georgia Georgia 1,026 0% 91
Ghana Ghana 1,187 0% 73
Guinea Guinea 1,651 0% 48
Gambia Gambia 836 0% 100
Guinea-Bissau Guinea-Bissau 1,577 0% 53
Equatorial Guinea Equatorial Guinea 2,156 0% 25
Greece Greece 652 0% 117
Grenada Grenada 2,350 0% 17
Guatemala Guatemala 1,996 0% 33
Guyana Guyana 2,387 0% 16
Honduras Honduras 1,976 0% 34
Croatia Croatia 1,113 0% 82
Haiti Haiti 1,440 0% 60
Hungary Hungary 589 0% 130
Indonesia Indonesia 2,702 0% 10
India India 1,083 0% 84
Ireland Ireland 1,118 0% 81
Iran Iran 228 0% 156
Iraq Iraq 216 0% 158
Iceland Iceland 1,940 0% 36
Israel Israel 435 0% 144
Italy Italy 832 0% 101
Jamaica Jamaica 2,051 0% 29
Jordan Jordan 111 0% 166
Japan Japan 1,668 0% 47
Kazakhstan Kazakhstan 250 0% 154
Kenya Kenya 630 0% 121
Kyrgyzstan Kyrgyzstan 533 0% 137
Cambodia Cambodia 1,904 0% 37
St. Kitts & Nevis St. Kitts & Nevis 1,427 0% 61
South Korea South Korea 1,274 0% 70
Kuwait Kuwait 121 0% 165
Laos Laos 1,834 0% 38
Lebanon Lebanon 661 0% 114
Liberia Liberia 2,391 0% 15
Libya Libya 56 0% 173
St. Lucia St. Lucia 2,301 0% 21
Sri Lanka Sri Lanka 1,712 0% 45
Lesotho Lesotho 788 0% 103
Lithuania Lithuania 656 0% 116
Luxembourg Luxembourg 934 0% 94
Latvia Latvia 667 0% 113
Morocco Morocco 346 0% 148
Moldova Moldova 450 0% 142
Madagascar Madagascar 1,513 0% 57
Maldives Maldives 1,972 0% 35
Mexico Mexico 758 0% 105
North Macedonia North Macedonia 619 0% 124
Mali Mali 282 0% 152
Malta Malta 560 0% 133
Myanmar (Burma) Myanmar (Burma) 2,091 0% 26
Mongolia Mongolia 241 0% 155
Mozambique Mozambique 1,032 0% 88
Mauritania Mauritania 92 0% 167
Mauritius Mauritius 2,041 0% 31
Malawi Malawi 1,181 0% 74
Malaysia Malaysia 2,875 0% 8
Namibia Namibia 285 0% 151
Niger Niger 151 0% 163
Nigeria Nigeria 1,150 0% 78
Nicaragua Nicaragua 2,280 0% 22
Netherlands Netherlands 778 0% 104
Norway Norway 1,414 0% 63
Nepal Nepal 1,500 0% 58
New Zealand New Zealand 1,732 0% 44
Oman Oman 125 0% 164
Pakistan Pakistan 494 0% 140
Panama Panama 2,928 0% 5
Peru Peru 1,738 0% 43
Philippines Philippines 2,348 0% 18
Papua New Guinea Papua New Guinea 3,142 0% 3
Poland Poland 600 0% 127
Puerto Rico Puerto Rico 2,054 0% 28
North Korea North Korea 1,054 0% 86
Portugal Portugal 854 0% 97
Paraguay Paraguay 1,130 0% 80
Palestinian Territories Palestinian Territories 402 0% 146
Qatar Qatar 74 0% 171
Romania Romania 637 0% 119
Russia Russia 460 0% 141
Rwanda Rwanda 1,212 0% 72
Saudi Arabia Saudi Arabia 59 0% 172
Sudan Sudan 250 0% 154
Senegal Senegal 686 0% 111
Singapore Singapore 2,497 0% 14
Solomon Islands Solomon Islands 3,028 0% 4
Sierra Leone Sierra Leone 2,526 0% 13
El Salvador El Salvador 1,784 0% 41
Somalia Somalia 282 0% 152
South Sudan South Sudan 900 0% 95
São Tomé & Príncipe São Tomé & Príncipe 3,200 0% 2
Suriname Suriname 2,331 0% 19
Slovakia Slovakia 824 0% 102
Slovenia Slovenia 1,162 0% 77
Sweden Sweden 624 0% 123
Eswatini Eswatini 788 0% 103
Seychelles Seychelles 2,330 0% 20
Syria Syria 252 0% 153
Chad Chad 322 0% 150
Togo Togo 1,168 0% 76
Thailand Thailand 1,622 0% 50
Tajikistan Tajikistan 691 0% 110
Turkmenistan Turkmenistan 161 0% 162
Timor-Leste Timor-Leste 1,500 0% 58
Trinidad & Tobago Trinidad & Tobago 2,200 0% 24
Tunisia Tunisia 207 0% 159
Turkey Turkey 593 0% 128
Tanzania Tanzania 1,071 0% 85
Uganda Uganda 1,180 0% 75
Ukraine Ukraine 565 0% 131
Uruguay Uruguay 1,300 0% 68
United States United States 715 0% 107
Uzbekistan Uzbekistan 206 0% 160
St. Vincent & Grenadines St. Vincent & Grenadines 1,583 0% 52
Venezuela Venezuela 2,044 0% 30
Vietnam Vietnam 1,821 0% 40
Vanuatu Vanuatu 2,000 0% 32
Samoa Samoa 2,880 0% 7
Yemen Yemen 167 0% 161
South Africa South Africa 495 0% 139
Zambia Zambia 1,020 0% 92
Zimbabwe Zimbabwe 657 0% 115

                    
# 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 = 'AG.LND.PRCP.MM'

# 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 <- 'AG.LND.PRCP.MM'

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