Reference · Public data

Countries

The reference table every other dataset joins on.

ISO 3166 (iso-codes via pycountry) + World Bank country API · iso-codes: LGPL-2.1 · commons_pubdata.reference.countries

Read Markdown
210 capitals, coloured by World Bank income group.
210 capitals, coloured by World Bank income group.

Query it with DuckDB.

Bash
lhbox duckdb --catalog commons/pubdata
SQL · Countries per World Bank region and income group
SELECT wb_region, wb_income_level, count(*) AS countries
FROM commons_pubdata.reference.countries
WHERE wb_region IS NOT NULL
GROUP BY 1, 2 ORDER BY 1, 2;

Read it where you work.

Public, read-only data. With an account, lhbox duckdb attaches the catalog as commons_pubdata; an agent with the LakehouseBox connector opens it with open_public_catalog("commons/pubdata"). Without one, DuckDB reads the public files directly.

Example queries

  • Countries per World Bank region and income group
    SELECT wb_region, wb_income_level, count(*) AS countries
    FROM commons_pubdata.reference.countries
    WHERE wb_region IS NOT NULL
    GROUP BY 1, 2 ORDER BY 1, 2;
  • Attach a name and a region to your country codes
    SELECT s.country_code, c.name, c.wb_region, sum(s.revenue) AS revenue
    FROM my.sales AS s JOIN commons_pubdata.reference.countries AS c USING (country_code)
    GROUP BY 1, 2, 3;

Know your columns.

ColumnTypeMeaning
country_codestringISO 3166-1 alpha-2, the join key used across pubdata
iso3stringISO 3166-1 alpha-3 (the World Bank's key)
iso_numericintISO 3166-1 numeric
namestringISO short name in English
official_namestringISO official name where defined
common_namestringISO common name where defined
View all 12 columns
wb_regionstringWorld Bank region, e.g. Europe & Central Asia; null for territories the Bank does not classify
wb_income_levelstringWorld Bank income group: High income, Upper middle income, Lower middle income, Low income
capital_citystringcapital city as the World Bank lists it
capital_longitudedoublecapital's longitude (WGS84)
capital_latitudedoublecapital's latitude (WGS84)
flagstringthe flag emoji

Join keys: country_code, iso3.

Before you query.

  1. country_code (alpha-2) is the join key across pubdata; the World Bank indicators carry iso3 as well, and this table maps one to the other.
  2. Kosovo has no ISO alpha-2 code (the Bank uses XK), so a few Bank rows have no country_code.
  3. Territories (e.g.
  4. Greenland) are rows here even when the Bank has no region for them.

Source & licence.

Source
ISO 3166 (iso-codes via pycountry) + World Bank country API
Licence
iso-codes: LGPL-2.1 (data); World Bank: CC BY 4.0
Attribution
ISO 3166 names and codes from the Debian iso-codes project through pycountry (LGPL-2.1); region, income level and capitals from the World Bank Indicators API (CC BY 4.0).
Coverage
249 countries and territories; current state
Refresh
monthly, the whole table replaced; source version pycountry 26.2.16 + worldbank 73f56217ac23
Table
commons/pubdata · reference.countries · Iceberg v2 · browse the catalog
Recipe
pubdata/recipes/countries.py, registry entry pubdata/registry/countries.yaml

Source: ISO 3166 (iso-codes via pycountry) + World Bank country API · iso-codes: LGPL-2.1 · Snapshot shown: 10 Oct 2026HTML for people. Markdown for agents.