dataeuropa

European open data, read straight into a data frame

Clients for data.europa.eu in Python, Julia and R. Search about 1.9 million dataset records from EU institutions and national portals, download files with checksum checks, and read tables and geodata. The functions have the same names in all three languages, and no API key is needed.

From a search to a table

Air-quality readings from Lisbon, in three steps. Each language uses the same functions; only the prefix changes.

  1. Find datasets: Portuguese air-quality data published as CSV

    Python
    hits = de.search_datasets('"air quality"', country="pt", format="CSV")
    Julia
    hits = search_datasets("\"air quality\""; country="pt", format="CSV")
    R
    hits <- de_search_datasets('"air quality"', country = "pt", format = "CSV")
  2. List the files of the Lisbon dataset, without services or web pages

    Python
    files = de.distributions("6689f1686e4bd9bc98ed011b", files_only=True)
    Julia
    files = distributions("6689f1686e4bd9bc98ed011b"; files_only=true)
    R
    files <- de_distributions("6689f1686e4bd9bc98ed011b", files_only = TRUE)
  3. Read the first quarter of 2024 into a data frame

    Python
    qa = de.load_distribution(files[files.title == "QA_2024_Q1"].iloc[0])
    Julia
    qa = load_distribution(files[findfirst(==("QA_2024_Q1"), files.title), :])
    R
    qa <- de_load_distribution(files[files$title == "QA_2024_Q1", ])

    The first rows of qa: 73,969 readings, one per row

    DTM_LOCALPARAMETROLOCALUNIDADEVALOR
    2024-01-05 19:00:00.0PM25Calçada da Ajudaµg/m36.0
    2024-01-06 03:00:00.0PM25Calçada da Ajudaµg/m35.0
    2024-01-06 04:00:00.0PM25Calçada da Ajudaµg/m33.0

Install

Not yet on PyPI, the Julia registry or CRAN; install from GitHub for now.

Python
pip install "dataeuropa[pandas]"
Julia
using Pkg; Pkg.add(url="https://github.com/randsley/dataeuropa", subdir="julia")
R
remotes::install_github("randsley/dataeuropa", subdir = "r")

Then import dataeuropa as de, using DataEuropa or library(dataeuropa).

What you can do

The same functions in each language. R adds the prefix de_.

TaskPythonJuliaR
Find datasets
Search, as a tablesearch_datasetssearch_datasetsde_search_datasets
More than 1,000 resultsfetch_datasetsfetch_datasetsde_fetch_datasets
Count the matchescountcount_datasetsde_count
Values of a filter, with countsfacet_valuesfacet_valuesde_facet_values
The raw search resultsearchsearchde_search
Harvested cataloguescataloguescataloguesde_catalogues
Look inside a dataset
Full metadataget_datasetget_datasetde_get_dataset
Its files and servicesdistributionsdistributionsde_distributions
Get the data
Read a file into a tableload_distributionload_distributionde_load_distribution
Read geodata or a feature serviceload_geodataload_geodatade_load_geodata
Download a filedownloaddownload_distributionde_download
Cache responsescache_oncache_onde_cache_on
Query linked data
A dataset as RDFget_rdfget_rdfde_get_rdf
SPARQLsparqlsparqlde_sparql

Worked examples

Complete tasks, the same in each language.

Read them in Python, Julia or R.

Documentation