Fertilizer consumption (kilograms per hectare of arable land)

Source: worldbank.org, 01.09.2025

Year: 2022

Flag Country Value Value change, % Rank
Aruba Aruba 15.9 +0.0314% 142
Afghanistan Afghanistan 5.06 -2.84% 169
Angola Angola 13.3 +136% 148
Albania Albania 38.4 -62.1% 119
United Arab Emirates United Arab Emirates 327 0% 15
Argentina Argentina 63.3 +1.86% 97
Armenia Armenia 42.5 -8.31% 115
Antigua & Barbuda Antigua & Barbuda 7.33 -12% 157
Australia Australia 107 -11.3% 70
Austria Austria 97.4 -24% 77
Azerbaijan Azerbaijan 24.7 +10.3% 133
Burundi Burundi 39.8 +109% 117
Benin Benin 36.9 +12.8% 122
Burkina Faso Burkina Faso 13.3 +42% 147
Bangladesh Bangladesh 391 -1.17% 11
Bahrain Bahrain 90.6 -93.5% 85
Bosnia & Herzegovina Bosnia & Herzegovina 59.3 -4.38% 99
Belarus Belarus 195 +15.4% 29
Belize Belize 126 -66.6% 55
Bermuda Bermuda 60 -40.6% 98
Bolivia Bolivia 7.53 -19.3% 155
Brazil Brazil 363 -6.11% 12
Barbados Barbados 48 +28.9% 111
Brunei Brunei 177 0% 37
Bhutan Bhutan 16.9 -8.46% 140
Botswana Botswana 72.7 +22.7% 91
Central African Republic Central African Republic 0.0103 -95.7% 184
Canada Canada 117 -6.81% 60
Chile Chile 220 -23.3% 24
China China 398 -3.49% 10
Côte d’Ivoire Côte d’Ivoire 25.3 -33.2% 132
Cameroon Cameroon 14.6 +9.26% 144
Congo - Kinshasa Congo - Kinshasa 2 -1.48% 179
Congo - Brazzaville Congo - Brazzaville 11.7 +19.7% 149
Colombia Colombia 411 -22% 9
Comoros Comoros 3.91 +16.1% 173
Cape Verde Cape Verde 8.18 -23.5% 152
Costa Rica Costa Rica 771 +5.8% 5
Cuba Cuba 5.93 -76.8% 164
Cyprus Cyprus 128 -18.2% 53
Czechia Czechia 155 +4.33% 40
Germany Germany 117 -10.2% 62
Djibouti Djibouti 34 0% 124
Dominica Dominica 47.6 -34.9% 112
Denmark Denmark 116 -12.5% 64
Dominican Republic Dominican Republic 162 0% 39
Algeria Algeria 20.7 0% 136
Ecuador Ecuador 326 -11.4% 16
Egypt Egypt 538 -0.838% 6
Eritrea Eritrea 3.95 +31.5% 172
Spain Spain 111 -30% 67
Estonia Estonia 85.8 -17.1% 88
Ethiopia Ethiopia 37.8 -9.49% 120
Finland Finland 65.3 -33.4% 95
Fiji Fiji 128 +67.9% 51
France France 119 -23.6% 59
Faroe Islands Faroe Islands 149 0% 44
Micronesia (Federated States of) Micronesia (Federated States of) 0.465 0% 182
Gabon Gabon 104 +269% 71
United Kingdom United Kingdom 195 -19.3% 30
Georgia Georgia 83 -13.4% 90
Ghana Ghana 37 -0.841% 121
Guinea Guinea 5.63 +32.4% 165
Gambia Gambia 2.24 0% 178
Guinea-Bissau Guinea-Bissau 10.9 -3.67% 150
Equatorial Guinea Equatorial Guinea 7.08 -0.324% 160
Greece Greece 147 -22.1% 46
Grenada Grenada 92.5 -7.42% 82
Guatemala Guatemala 164 -25.2% 38
Guyana Guyana 42.7 -29.8% 114
Honduras Honduras 191 -0.00609% 32
Croatia Croatia 189 -9.37% 34
Haiti Haiti 5.55 -25.3% 166
Hungary Hungary 110 -33.7% 68
Indonesia Indonesia 308 -18.4% 18
India India 193 -0.00905% 31
Ireland Ireland 1,198 -20% 4
Iran Iran 68.3 0% 92
Iraq Iraq 51.1 +0.68% 107
Iceland Iceland 126 -9.89% 56
Italy Italy 114 +0.994% 66
Jamaica Jamaica 59.3 -9.19% 101
Jordan Jordan 98.1 +10.8% 76
Japan Japan 218 +0.492% 25
Kazakhstan Kazakhstan 3.87 -12.9% 174
Kenya Kenya 35.1 -35.8% 123
Kyrgyzstan Kyrgyzstan 25.7 -1.71% 131
Cambodia Cambodia 32.9 -33.6% 126
Kiribati Kiribati 4.93 0% 170
St. Kitts & Nevis St. Kitts & Nevis 5.2 0% 167
South Korea South Korea 325 +15.6% 17
Kuwait Kuwait 1,358 +12.4% 3
Laos Laos 90.2 -5.43% 87
Lebanon Lebanon 121 -17.1% 57
Liberia Liberia 19.3 0% 137
Libya Libya 16.3 +10.8% 141
St. Lucia St. Lucia 200 0% 28
Sri Lanka Sri Lanka 154 0% 42
Lesotho Lesotho 8.36 -48.2% 151
Lithuania Lithuania 96.1 -31.2% 79
Luxembourg Luxembourg 141 -37.9% 49
Latvia Latvia 102 -9.08% 74
Morocco Morocco 53.5 -3.32% 105
Moldova Moldova 40.4 -20.1% 116
Madagascar Madagascar 6.88 +5.39% 162
Maldives Maldives 65.8 -40.2% 94
Mexico Mexico 83.2 -23.9% 89
North Macedonia North Macedonia 44.7 -11.5% 113
Mali Mali 7.66 -5.31% 154
Malta Malta 101 -32.3% 75
Myanmar (Burma) Myanmar (Burma) 24.1 -37.8% 134
Montenegro Montenegro 191 -38.8% 33
Mongolia Mongolia 0 -100% 186
Mozambique Mozambique 7.99 -34.8% 153
Mauritania Mauritania 14.1 0% 145
Mauritius Mauritius 126 -32.2% 54
Malawi Malawi 23.7 -43.4% 135
Malaysia Malaysia 1,612 -25% 2
Namibia Namibia 14.9 +300% 143
New Caledonia New Caledonia 249 0% 20
Niger Niger 0.468 -0.298% 181
Nigeria Nigeria 7.28 -59.5% 158
Nicaragua Nicaragua 59.3 -13.7% 100
Netherlands Netherlands 247 -9.75% 21
Norway Norway 206 -2.3% 27
Nepal Nepal 67.8 -39.8% 93
New Zealand New Zealand 1,633 +13% 1
Oman Oman 345 -9.37% 13
Pakistan Pakistan 147 -9.27% 45
Panama Panama 59.2 -52.2% 102
Peru Peru 103 -7.64% 72
Philippines Philippines 285 +23% 19
Palau Palau 28.6 0% 129
Papua New Guinea Papua New Guinea 144 +33% 47
Poland Poland 155 -0.77% 41
Puerto Rico Puerto Rico 49.3 0% 109
North Korea North Korea 7.07 -62.5% 161
Portugal Portugal 116 -34.8% 63
Paraguay Paraguay 96.7 -35.2% 78
Qatar Qatar 240 0% 22
Romania Romania 90.3 -8.19% 86
Russia Russia 28.2 +2.55% 130
Rwanda Rwanda 29.1 +21.6% 128
Saudi Arabia Saudi Arabia 119 +1.67% 58
Sudan Sudan 7.1 -0.0149% 159
Senegal Senegal 18.5 +110% 139
Singapore Singapore 152 0% 43
Solomon Islands Solomon Islands 29.5 +166% 127
Sierra Leone Sierra Leone 2.67 0% 176
El Salvador El Salvador 39.2 -57.5% 118
Somalia Somalia 0.129 -90.4% 183
Serbia Serbia 141 +88.6% 48
South Sudan South Sudan 0.000555 -99.5% 185
São Tomé & Príncipe São Tomé & Príncipe 48.5 0% 110
Suriname Suriname 186 +5.83% 35
Slovakia Slovakia 117 -12.7% 61
Slovenia Slovenia 216 -13.3% 26
Sweden Sweden 103 -9.07% 73
Eswatini Eswatini 92 0% 83
Seychelles Seychelles 511 -5.8% 7
Syria Syria 6.42 +61.5% 163
Chad Chad 4.65 0% 171
Togo Togo 13.3 +544% 146
Thailand Thailand 109 -22.1% 69
Tajikistan Tajikistan 93.3 +3.3% 81
Turkmenistan Turkmenistan 343 +26.7% 14
Timor-Leste Timor-Leste 1.18 -6.28% 180
Tonga Tonga 5.15 -54.6% 168
Trinidad & Tobago Trinidad & Tobago 139 +8.82% 50
Tunisia Tunisia 52.1 -13.4% 106
Turkey Turkey 115 -11.5% 65
Tanzania Tanzania 19.1 +106% 138
Uganda Uganda 2.61 +7.07% 177
Ukraine Ukraine 55.6 -29.1% 104
Uruguay Uruguay 178 -15.7% 36
United States United States 128 -2.14% 52
Uzbekistan Uzbekistan 237 -20.1% 23
St. Vincent & Grenadines St. Vincent & Grenadines 93.5 0% 80
Venezuela Venezuela 50.9 0% 108
Vietnam Vietnam 418 -9.39% 8
Vanuatu Vanuatu 56.2 +0.00623% 103
Samoa Samoa 3.84 0% 175
Yemen Yemen 7.49 +62.6% 156
South Africa South Africa 91.5 -12.6% 84
Zambia Zambia 64.6 +1.03% 96
Zimbabwe Zimbabwe 33.3 -1.3% 125

                    
# 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.CON.FERT.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 <- 'AG.CON.FERT.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))