DataBrighten

    Oil rents (% of GDP)

    8,418 × 6rows × columns: 200 countries, 1970 to 2021

    Real data: World Bank, World Development Indicators, indicator NY.GDP.PETR.RT.ZS, retrieved 19 November 2026. Values are as published; we only reshaped the file.

    textnumberdateyes/no
    Rows8,418country-year values
    Countries200with at least one value
    Years1970 – 202152 years with data
    LicenceCC BY 4.0credit the World Bank

    What it measures

    Oil rents are the difference between the value of crude oil production at regional prices and total costs of production.

    The numbers in 2021

    In 2021, 190 countries have a value. The highest is Libya (56.38); at the bottom, 76 countries tie at 0 (e.g. American Samoa, Antigua and Barbuda, Armenia). The median country value is 0.0142. The World Bank's World aggregate for 2021 is 1.36.

    Top 10 countries, 2021

    % of GDP

    Source: World Bank, NY.GDP.PETR.RT.ZS, retrieved 19 November 2026. Computed from oil-rents-percent-of-gdp.csv.

    Highest, 2021

    #CountryValue
    1Libya56.38
    2Iraq42.79
    3Congo, Rep.34.38
    4Angola28.27
    5Saudi Arabia23.69
    6Oman23.54
    7Guyana22.08
    8Azerbaijan20.98
    9Iran, Islamic Rep.18.27
    10Chad16.75

    Lowest, 2021

    Ties are listed A to Z.

    #CountryValue
    1Zambia0
    2West Bank and Gaza0
    3Vanuatu0
    4Uganda0
    5Turks and Caicos Islands0
    6Tonga0
    7Togo0
    8Tanzania0
    9St. Vincent and the Grenadines0
    10St. Lucia0
    How many countries report, by decade
    DecadeMost countries in one year
    1970s95
    1980s157
    1990s186
    2000s196
    2010s197
    2020s195

    World aggregate by year

    As published by the World Bank (in the regions file, not the country file).

    YearWorld
    20211.36
    20200.71
    20191.35
    20181.57
    20171.1
    20160.831
    20150.987
    20142.12
    20132.42
    20122.66
    20112.79
    20102.05

    By region, 2021

    World Bank regionValue
    Middle East, North Africa, Afghanistan & Pakistan13.97
    Sub-Saharan Africa 3.8
    Latin America & Caribbean 1.93
    Europe & Central Asia1.07
    North America0.785
    South Asia0.281
    East Asia & Pacific0.272

    First rows

    oil-rents-percent-of-gdp.csv

    countrytextiso3textregiontextincome_grouptextyearnumbervaluenumber
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19700.0265662947026768
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19710.0453108139131106
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19720.0557663770385733
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19730.07633415678642
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19740.427935476827928
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19750.520410843483266
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19760.646363012764153
    AfghanistanAFGMiddle East, North Africa, Afghanistan & PakistanLow income19770.687944963914268

    Data dictionary

    ColumnTypeMeaning
    countrytextCountry or economy, World Bank name
    iso3textISO 3166-1 alpha-3 code
    regiontextWorld Bank region
    income_grouptextWorld Bank income group
    yearnumberCalendar year of the value
    valuenumberOil rents (% of GDP), exactly as the World Bank API returns it (not rounded)

    Only country-years with a value are in the long file; blank cells in the wide file mean no value was published.

    Practice questions

    answers computed from the file

    Which country has the highest value in 2021?

    Libya, with 56.38.

    Excel (on the long CSV: E = year, F = value)

    =FILTER(A2:A100000,(E2:E100000=2021)*(F2:F100000=MAXIFS(F2:F100000,E2:E100000,2021)))

    SQL (table wb = the CSV)

    SELECT country, value FROM wb WHERE year = 2021
      AND value = (SELECT MAX(value) FROM wb WHERE year = 2021);

    pandas (df = pd.read_csv("oil-rents-percent-of-gdp.csv"))

    y = df[df.year == 2021]
    y[y.value == y.value.max()][["country", "value"]]

    File: oil-rents-percent-of-gdp.csv

    How many countries report a value for 2021?

    190 of the 217 economies in the file's country list.

    Excel (on the long CSV: E = year, F = value)

    =COUNTIF(E2:E100000,2021)

    SQL (table wb = the CSV)

    SELECT COUNT(*) FROM wb WHERE year = 2021;

    pandas (df = pd.read_csv("oil-rents-percent-of-gdp.csv"))

    (df.year == 2021).sum()

    File: oil-rents-percent-of-gdp.csv

    What is the median across countries in 2021?

    0.0142 (median of the 190 country values; not a World Bank aggregate).

    Excel (on the long CSV: E = year, F = value)

    =MEDIAN(FILTER(F2:F100000,E2:E100000=2021))

    SQL (table wb = the CSV)

    -- SQLite has no MEDIAN(); this picks the middle value(s)
    SELECT AVG(value) FROM (SELECT value FROM wb WHERE year = 2021 ORDER BY value
      LIMIT 2 - (SELECT COUNT(*) FROM wb WHERE year = 2021) % 2
      OFFSET (SELECT (COUNT(*) - 1) / 2 FROM wb WHERE year = 2021));

    pandas (df = pd.read_csv("oil-rents-percent-of-gdp.csv"))

    df[df.year == 2021]["value"].median()

    File: oil-rents-percent-of-gdp.csv

    Which country rose the most between 2011 and 2021?

    Guyana: from 0 to 22.08, a rise of 22.08 (out of 186 countries with both years).

    Excel (on the long CSV: E = year, F = value)

    Use the wide file (oil-rents-percent-of-gdp-wide.csv): add a column = [2021] - [2011], then sort it largest to smallest.

    SQL (table wb = the CSV)

    SELECT a.country, b.value - a.value AS rise FROM wb a JOIN wb b ON a.iso3 = b.iso3
    WHERE a.year = 2011 AND b.year = 2021 ORDER BY rise DESC LIMIT 1;

    pandas (df = pd.read_csv("oil-rents-percent-of-gdp.csv"))

    w = df.pivot(index="country", columns="year", values="value")
    (w[2021] - w[2011]).dropna().nlargest(1)

    File: oil-rents-percent-of-gdp.csv

    Which year has the most countries reporting?

    2018, with 197 countries. (Later years are still filling in as countries report.)

    Excel (on the long CSV: E = year, F = value)

    Make a pivot table: year in Rows, Count of value in Values, then sort by the count.

    SQL (table wb = the CSV)

    SELECT year, COUNT(*) AS n FROM wb GROUP BY year ORDER BY n DESC, year DESC LIMIT 1;

    pandas (df = pd.read_csv("oil-rents-percent-of-gdp.csv"))

    df.groupby("year").size().sort_values(ascending=False).head(1)

    File: oil-rents-percent-of-gdp.csv