Skip to content

pycensus.census.countries.eu.eurostat.api

Client for the Eurostat dissemination API (JSON-stat 2.0, keyless).

Technical aspects

GET https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/<dataset>?<dim>=<code>&... returns one JSON-stat dataset: value is a sparse {flat index: number} map over the cartesian product of the dimensions listed in id with sizes size. :func:fetch fixes every dimension except geo and time (it raises if the filters leave another dimension with several categories, so values of different meaning are never mixed) and returns a long table geo, time, value. geoLevel=nuts0..3 restricts geo to one NUTS level. Checked live 2026-11-17.

EurostatError

Bases: RuntimeError

The API answered with an error, or the filters do not fix every non-geo dimension.

parse_jsonstat(j)

Long table geo, time, value from a JSON-stat 2.0 dataset whose other dimensions have one category each.

Parameters:

Name Type Description Default
j dict

Parsed JSON-stat response.

required

Returns:

Type Description
DataFrame

DataFrame with geo (str), time (str) and value (float).

Raises:

Type Description
EurostatError

if a dimension other than geo/time has more than one category.

fetch(dataset, filters=None, nuts_level=None, since=None, geos=None, chunk=150)

One Eurostat dataset as a long geo, time, value table.

Parameters:

Name Type Description Default
dataset str

Eurostat dataset code (nama_10r_3gdp).

required
filters Optional[Dict[str, str]]

{dimension: code} fixing every dimension except geo and time.

None
nuts_level Optional[int]

0-3 to keep only that NUTS level (ignored when geos is given).

None
since Optional[int]

first year (sinceTimePeriod).

None
geos Optional[List[str]]

explicit geo codes (requested in chunks of chunk).

None
chunk int

geo codes per request.

150

Returns:

Type Description
DataFrame

DataFrame geo, time, value.