Eurostat API Client (Python)
Use the Eurostat API Client to quickly retrieve json data from Eurostat REST service and convert it to a pandas DataFrame. A simple description of the service can be found here
Installation
Install Eurostat API Client using pip.
pip install eurostatapiclient
Quick start
This example shows how to retrieve a dataset and a pandas dataframe from it.
from eurostatapiclient import EurostatAPIClient
# Choose service version : only 1.0 is currently available
VERSION = '1.0'
# Only json is currently available
FORMAT = 'json'
# Specify language : en, fr, de
LANGUAGE = 'en'
client = EurostatAPIClient(VERSION, FORMAT, LANGUAGE)
# Optionnal : working behing a proxy :
# client.set_proxy({'http':'my.proxy.com/8080', 'https':'my.proxy.com/8080'})
dataset = client.get_dataset('tps00001')
print(dataset.label)
dataframe = dataset.to_dataframe()
print(dataframe.head())
# Add some filters (only mono-filtering is available for now)
params = {
'geo': 'DE',
}
# Note that some keys may be repeated in eurostat's api
# In that case, you will want to pass params as a list of tuples
# ex. :
# params = [
# ('siec', 'TOTAL'),
# ('precision', '1'),
# ('unit', 'KTOE'),
# ('nrg_bal', 'AFC'),
# ('nrg_bal', 'DL'),
# ('nrg_bal', 'EXP'),
# ('nrg_bal', 'FC_E'),
# ('nrg_bal', 'FEC2020-2030')]
# filtered_dataset = client.get_dataset('nrg_bal_c', params=params)
filtered_dataset = client.get_dataset('tps00001', params=params)
filtered_dataframe = filtered_dataset.to_dataframe()
print(filtered_dataframe.head())
Contributions
Contributions are welcome !
Feel free to suggest modifications/enhancements in the "issues" section, or to create a pull request
Metadata
Release files for eurostatapiclient 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eurostatapiclient-0.3.0.tar.gz | 14.3 kB | Without provenance | Details for eurostatapiclient-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eurostatapiclient-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for eurostatapiclient-0.3.0-py3-none-any.whl |
Total release size: 26.7 kB
Release files / eurostatapiclient-0.3.0.tar.gz
| Download URL | eurostatapiclient-0.3.0.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff0442b9b0a21cb2ca51c7abdb40595569f22ab6a88ff1c863d4bedfd6bfde69
|
|
BLAKE2b-256 checksum How to use checksums |
0db8cf361ac15e16680bac3c4c0728ddbc39917849a6fa52fe4884fcab136967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Release files / eurostatapiclient-0.3.0-py3-none-any.whl
| Download URL | eurostatapiclient-0.3.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3cae81c6358d735c0ffc6190df02b24645e7631d714ebbd82231ebe108418b7
|
|
BLAKE2b-256 checksum How to use checksums |
28e8f449bf5382c5b0e260476e597362672b82200a152da3b0f7c31e23c4f7eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Security for eurostatapiclient 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.