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.
-
Find datasets: Portuguese air-quality data published as CSV
Pythonhits = de.search_datasets('"air quality"', country="pt", format="CSV")Juliahits = search_datasets("\"air quality\""; country="pt", format="CSV")Rhits <- de_search_datasets('"air quality"', country = "pt", format = "CSV") -
List the files of the Lisbon dataset, without services or web pages
Pythonfiles = de.distributions("6689f1686e4bd9bc98ed011b", files_only=True)Juliafiles = distributions("6689f1686e4bd9bc98ed011b"; files_only=true)Rfiles <- de_distributions("6689f1686e4bd9bc98ed011b", files_only = TRUE) -
Read the first quarter of 2024 into a data frame
Pythonqa = de.load_distribution(files[files.title == "QA_2024_Q1"].iloc[0])Juliaqa = load_distribution(files[findfirst(==("QA_2024_Q1"), files.title), :])Rqa <- de_load_distribution(files[files$title == "QA_2024_Q1", ])The first rows of
qa: 73,969 readings, one per rowDTM_LOCAL PARAMETRO LOCAL UNIDADE VALOR 2024-01-05 19:00:00.0 PM25 Calçada da Ajuda µg/m3 6.0 2024-01-06 03:00:00.0 PM25 Calçada da Ajuda µg/m3 5.0 2024-01-06 04:00:00.0 PM25 Calçada da Ajuda µg/m3 3.0
Install
Not yet on PyPI, the Julia registry or CRAN; install from GitHub for now.
pip install "dataeuropa[pandas]"using Pkg; Pkg.add(url="https://github.com/randsley/dataeuropa", subdir="julia")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_.
| Task | Python | Julia | R |
|---|---|---|---|
| Find datasets | |||
| Search, as a table | search_datasets | search_datasets | de_search_datasets |
| More than 1,000 results | fetch_datasets | fetch_datasets | de_fetch_datasets |
| Count the matches | count | count_datasets | de_count |
| Values of a filter, with counts | facet_values | facet_values | de_facet_values |
| The raw search result | search | search | de_search |
| Harvested catalogues | catalogues | catalogues | de_catalogues |
| Look inside a dataset | |||
| Full metadata | get_dataset | get_dataset | de_get_dataset |
| Its files and services | distributions | distributions | de_distributions |
| Get the data | |||
| Read a file into a table | load_distribution | load_distribution | de_load_distribution |
| Read geodata or a feature service | load_geodata | load_geodata | de_load_geodata |
| Download a file | download | download_distribution | de_download |
| Cache responses | cache_on | cache_on | de_cache_on |
| Query linked data | |||
| A dataset as RDF | get_rdf | get_rdf | de_get_rdf |
| SPARQL | sparql | sparql | de_sparql |
Worked examples
Complete tasks, the same in each language.
- Air quality in Lisbon From a search to mean NO₂ per station, with the data's missing-value code and a minimum number of readings.
- Who publishes air-quality data, and in what formats Counts and filter values without downloading any records.
- Boundaries of Gelsenkirchen from a feature service The same layer through OGC API Features and WFS, with areas and reprojection.
Documentation
- Python
Package
dataeuropa. Needs only requests; pandas, geopandas, openpyxl and pyarrow are optional. - Julia
Package
DataEuropa, built on HTTP, JSON3, DataFrames and CSV. GeoDataFrames, XLSX and Parquet2 are optional. - R
Package
dataeuropa, built on httr2 and jsonlite, returning base data frames. sf, readxl and arrow are optional.