If the package is already installed, but a new version is available, the installation can be upgraded to the latest version by running from a terminal/shell window:
This package contains three main functions: [`get_table()`](https://embo.pages.nilu.no/eurostat-data/estatimport.html#estatimport.estatimport..get_table) to get the data using the API, [`table_dict()`](https://embo.pages.nilu.no/eurostat-data/estatimport.html#estatimport.estatimport.table_dict) to generate the dictionary required as input of `get_table()` and [`table_parameters()`](https://embo.pages.nilu.no/eurostat-data/estatimport.html#estatimport.estatimport.table_parameters) to get the possible values that can fill the dictionary generated by `table_dict()`.
To use these functions, you must know the table code associated with the data you want to get. The code of any table can be found on the [eurostat website](https://ec.europa.eu/eurostat/databrowser/explore/all/all_themes?lang=en&display=list&sort=category).
**Both `table_dict()` and `table_parameters()` requires a table code as argument.**
Example of `table_dict()` with the table code `ENV_WASTRT`:
```
>>> table_dict('ENV_WASTRT')
{'table_code': ['ENV_WASTRT'],
'freq': [],
'unit': [],
'age': [],
'sex': [],
'geo': [],
'TIME_PERIOD': []}
```
**/!\\ If one or more parameters are left empty or not included, all of their possible values will be considered! /!\\**
### Docker
Make sure that Docker engine is installed (https://www.docker.com/).
Then build and run the `docker-compose` file.
Example of `table_parameters()` with the table code `DEMO_PJAN`:
```
>>> table_parameters('ENV_WASTRT')
parameter name: 'freq'
Possible values: A
parameter name: 'unit'
Possible values: ['KG_HAB', 'T']
parameter name: 'hazard'
Possible values: ['HAZ_NHAZ', 'HAZ', 'NHAZ']
parameter name: 'wst_oper'
Possible values: ['TRT', 'DSP_L_OTH', 'DSP_L', 'DSP_I', 'DSP_OTH',
'RCV_E', 'RCV_R_B', 'RCV_R', 'RCV_B']
parameter name: 'waste'
Possible values: ['TOTAL', 'W01-05', 'W011', 'W012', 'W013', 'W02A',
'W032', 'W033', 'W05', 'W06_07A', 'W061', 'W062',
'W063', 'W071', 'W072', 'W073', 'W074', 'W075',
'W076', 'W077', 'W08A', 'W081', 'W0841', 'W09',
'W091', 'W092', 'W093', 'W10', 'W101', 'W102',
'W103', 'W11', 'W121', 'W12B', 'W124', 'W126',
'W127', 'W128_13', 'W06', 'W091_092', 'W11_127',
'W12_X_127NH', 'RCV_OTH', 'DSP_OTH', 'INC_OTH',
'TOT_X_MIN']
parameter name: 'geo'
Possible values: ['EU27_2020', 'EU28', 'BE', 'BG', 'CZ', 'DK', 'DE',
Possible values: ['2004', '2006', '2008', '2010', '2012', '2014',
'2016', '2018', '2020']
# build and run
docker-compose build
docker-compose up
```
The application will run at `http://localhost:8501`
**`get_table()` requires a dictionary as input. The empty dictionary of a
table can be generated with `table_dict()`.**
Examples of `get_table()`:
```
>>> table_dict = {'table_code': ['ENV_WASTRT'],
'freq': ['A'],
'unit': ['T'],
'hazard': ['HAZ_NHAZ'],
'wst_oper': ['DSP_L', 'DSP_I'],
'waste': ['W033', 'W05'],
'geo': ['NO','FR','DE'],
'TIME_PERIOD': ['2010','2012']}
>>> df_eurodata = get_table(table_dict)
>>> df_eurodata
2010 2012
DE 232178 308425
FR 451853 419699
NO 0 0
>>> get_table(table_dict, dtype='array')
array([[[[[[[ 75032, 180400],
[ 45735, 58448],
[ 0, 0]],
[[ 1404, 1142],
[ 1019, 3348],
[ 0, 0]]],
[[[ 10981, 8575],
[ 19398, 15961],
[ 0, 0]],
[[144761, 118308],
[385701, 341942],
[ 0, 0]]]]]]])
```
**/!\\** __If one or more parameters are left empty or not included, all of their possible values will be considered!__ **/!\\**
**/!\\** If `dtype = 'array'`, be careful as the order of the parameters in the table dictionary might differ from the order in of the parameters in
the array. The order provided by the array will follow the same order
as the one provided with `table_parameters()`. **/!\\**
For more information and functionalities, read the [docs](https://embo.pages.nilu.no/eurostat-data/estatimport.html).
## 4. References
Based on the eurostat api documentation published here: [eurostat API](https://wikis.ec.europa.eu/display/EUROSTATHELP/API+-+Getting+started)
## 5. Citation
Please cite by refering to the webadress of this repository.
In the future, the repository will be archived periodically on Zenodo with a digital object identifier. We are open to collaboration and we encourage contribution.
## 6. License
## 3. License
GPLv3 license.
## 7. Funding
This work has received funding through NILUs basic grant provided by the Norwegian Ministry of Climate and Environment.
## 4. Funding
This work has received co-funding from the Horizon Europe Partnership for the Assessment of Risks of Chemicals (PARC) under Grant Agreement 101057014.