eurostat


Nameeurostat JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryEurostat Python Package
upload_time2024-06-13 15:26:14
maintainerNone
docs_urlNone
authorNoemi Emanuela Cazzaniga
requires_python>=3.5
licenseMIT
keywords eurostat comext prodcom statistics data economics science
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Eurostat Python Package

Tools to read data from Eurostat API.


# Features

* Read Eurostat data and metadata as list of tuples or as pandas dataframe.
* Use the new SDMX 2.1 Eurostat web services.
* Download data from Eurostat, COMEXT, DG COMP, DG EMPL, DG GROW.
* Available from both pip and [conda][condapack]. 
* MIT license.


# Important!

From version 1.0.0, this package implements MAJOR CHANGES.

The previous official Eurostat API, used by the older releases of this Python package, is supposed to be decommissioned in January 2023.
It has been replaced with a new dissemination API.
This forced to rewrite this Python package, almost completely.

I have done my best to make the new Eurostat Python package compatible with the old releases.
Nevertheless, you may see some differences, also in the output format.

The main differences are in the SDMX functions.
In particular, OBS_STATUS is no more provided by the API.
It is replaced by a flag, that has different symbols and meanings.
From version 1.0.0, the SDMX functions of the Eurostat Python package are deprecated, but temporarily kept available.
These functions will be removed from version 2.0.0 of the Eurostat Python package.
They always print an alert message, that can be "muted" by setting the argument *noalert=True*.


# Documentation


## Getting started:

Requires Python 3.5+

```bash
pip install eurostat
```


## Read the table of contents of the Eurostat database:

### As a list of tuples:

```python
eurostat.get_toc([agency='all'], [dataset='all'], [lang='en'])
```

Read the table of contents and return a list of tuples. The first element of the list contains the header line. Dates are represented as strings.

*agency* allows to download only the table of contents of some agencies. They can be provided as a list or as a string, if only one agency is wanted.
Allowed agencies are: 'EUROSTAT', 'COMEXT', 'COMP', 'EMPL', 'GROW'.

*lang* allows to download the table of contents in one of the following languages: *'en'*=English, *'fr'*=French, *'de'*=German, when provided by Eurostat. Default is English.

If you want to get only the metadata of one dataset, set *dataset=code*, e.g. *dataset='MET_10R_3EMP'*.

#### Example:

```python
>>> import eurostat
>>> toc = eurostat.get_toc()
>>> toc[0]
('title', 'code', 'type', 'last update of data', 'last table structure change', 'data start', 'data end')
>>> toc[12:15]
[('Employment by NACE Rev. 2 activity and metropolitan typology', 'MET_10R_3EMP', 'dataset', '2022-05-06T23:00:00+0200', '2022-05-06T23:00:00+0200', '1995', '2020'),
 ('Gross domestic product (GDP) at current market prices by metropolitan regions', 'MET_10R_3GDP', 'dataset', '2022-04-21T23:00:00+0200', '2022-04-21T23:00:00+0200', '2000', '2020'),
 ('Gross value added at basic prices by metropolitan regions', 'MET_10R_3GVA', 'dataset', '2022-04-21T23:00:00+0200', '2022-04-21T23:00:00+0200', '1995', '2020')]
```

### As a pandas dataframe:

```python
eurostat.get_toc_df([agency='all'], [dataset='all'], [lang='en'])
```

Read the table of contents of the main database and return a dataframe.

*agency* allows to download only the table of contents of some agencies. They can be provided as a list or as a string, if only one agency is wanted.
Allowed agencies are: 'EUROSTAT', 'COMEXT', 'COMP', 'EMPL', 'GROW'.

*lang* allows to download the table of contents in one of the following languages: *"en"*=English, *"fr"*=French, *"de"*=German, when provided by Eurostat. Default is English.

If you want to get only the metadata of one dataset, set *dataset=code*, e.g. *dataset='MET_10R_3EMP'*.

#### Example:

```python
>>> import eurostat
>>> toc_df = eurostat.get_toc_df()
>>> toc_df
                                                  title  ... data end
0     Road equipment: number of road vehicles by cat...  ...     2018
1        Road equipment: number of road vehicles by age  ...     2018
2              Road equipment: load capacity of lorries  ...     2015
3       Road equipment: new registrations by categories  ...     2015
4        Road traffic: road freight transport in volume  ...     2018
                                                ...  ...      ...
7225  Tropical wood imports to the EU from chapter 4...  ...  2020-12
7226  Candidate countries and potential candidates: ...  ...     2019
7227  Candidate countries and potential candidates: ...  ...     2014
7228  Candidate countries and potential candidates: ...  ...     2015
7229  Candidate countries and potential candidates: ...  ...     2014
```

You may also want to extract the datasets that pertain a topic. In that case, you can use:

```python
eurostat.subset_toc_df(toc_df, keyword)
```

Extract from toc_df the rows where the column *title* contains *keyword* (case-insensitive).

#### Example:

```python
>>> f = eurostat.subset_toc_df(toc_df, 'fleet')
>>> f
                                                  title  ... data end
4873                       Fishing fleet, total tonnage  ...     2021
4895                   Fishing Fleet, Number of Vessels  ...     2021
6169  Commercial aircraft fleet by age of aircraft a...  ...     2020
6172  Commercial aircraft fleet by age of aircraft a...  ...     2020
6175  Commercial aircraft fleet by aircraft category...  ...     2020
6178  Commercial aircraft fleet by aircraft category...  ...     2020
6576      Commercial aircraft fleet by type of aircraft  ...     2020
7120     Fishing fleet by age, length and gross tonnage  ...     2021
7121     Fishing fleet by type of gear and engine power  ...     2021
```


## Get the filter parameters to download a subset of a dataset:

```python
eurostat.get_pars(code)
```

Read the parameter names that can be filtered for a given dataset *code* and return them as a list.

#### Example:

```python
>>> import eurostat
>>> pars = eurostat.get_pars('demo_r_d2jan')
>>> pars
['freq', 'unit', 'sex', 'age', 'geo']
```

From the example, you can note that *code* is generally case-insensitive.

To get the parameter values for filtering, you can use:

```python
eurostat.get_par_values(code, par)
```

Read the values of a given parameter *par* that can be found in a given dataset *code*.

#### Example:

```python
>>> import eurostat
>>> par_values = eurostat.get_par_values('demo_r_d2jan', 'sex')
>>> par_values
['T', 'M', 'F']
```


## Get an Eurostat dictionary:

```python
eurostat.get_dic(code, [par=None], [full=True], [frmt="list"], [lang="en"])
```

Read the dictionary with the descriptions of the parameters (dimensions) of a dataset if *par =None* or
the descriptions of the values of a given parameter *par*, as a dataframe, a list of tuples or as a dictionary.

If you want the full list of possible values of *par*, set *full=True*, while *full=False* returns only the values that are in the given dataset, output from *get_par_values()*.
Default is *full=True*.

*frmt="list"* makes the function return a list of tuples without header.
For the dictionary of the parameters, the first element of each tuple is the parameter code, the second is its name, and the third is its description (when provided).
For the dictionary of the parameter values, the first element of each tuple is the code value and the second one is its description.
Set *frmt="df"* to get a dataframe as output.
If *frmt="dict"* it returns a dictionary.
Default is *frmt="list"*.

*lang* allows to download the dictionary in one of the following languages: *"en"*=English, *"fr"*=French, *"de"*=German, when provided by Eurostat. Default is English.


#### Example: Get the dictionary of the parameters of a dataset as a list of tuples

```python
>>> import eurostat
>>> dic = eurostat.get_dic('demo_r_d2jan')
>>> dic
[('freq', 'Time frequency', 'This code list contains the periodicity that refers to the frequency.'),
 ('unit', 'Unit of measure', None),
 ('sex', 'Sex', 'This code list provides information about the state of being male or female and refers ...'),
 ('age', 'Age class', 'This code list contains periods of time, i.e. the length of time that a person or ...'),
 ('geo', 'Geopolitical entity (reporting)', 'This code list defines the reporting geopolitical entities.')]
```

#### Example: Get the dictionary of the the parameter values of a dataset as a dataframe

```python
>>> import eurostat
>>> dic = eurostat.get_dic('demo_r_d2jan', 'sex', frmt='df')
>>> dic
    val                                          descr
0     T                                          Total
1     M                                          Males
2     F                                        Females
3  DIFF  Absolute difference between males and females
4   NAP                                 Not applicable
5   NRP                                    No response
6   UNK                                        Unknown
```



## Read a dataset:

### As a list of tuples:

```python
eurostat.get_data(code, [flags=False], [filter_pars=dict()], [verbose=False], [reverse_time=False])
```

Read an Eurostat dataset and returns it as a list of tuples.
The first element of the list ("the first row") is the data header.

To get a subset, set *filter_pars* (a dictionary where keys are parameter names, values are the wanted items).

To see a rough progress status, set *verbose=True*.

*flag=True* downloads also the flags associated to the data.
Pay attention: the data format changes if *flags* is *True* or not.
Flag meanings can be found [here][abbr].

*reverse_time=True* reverses the order of the time columns. For compatibility with 0.x.x versions.

#### Example: Full download a dataset without flags as list of tuples
 
```python
>>> import eurostat
>>> data = eurostat.get_data('GOV_10DD_SLGD')
>>> data[0]
('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\TIME_PERIOD', 2018, 2019, 2020, 2021)
>>> data[90:95]
[('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'BE', None, None, 23.8, 39.3),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'ES', None, None, 130.0, 122.2),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'AT', None, None, 0.0, 0.0),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'BE', None, None, 23.8, 39.3),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'ES', None, None, 130.0, 122.2)]
```

#### Example: Full download a dataset with flags as list of tuples
 
```python
>>> import eurostat
>>> data = eurostat.get_data('GOV_10DD_SLGD', True)
>>> data[0]
('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\TIME_PERIOD', '2018_value', '2018_flag', '2019_value', '2019_flag', '2020_value', '2020_flag', '2021_value', '2021_flag')
>>> data[90:95]
[('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'BE', None, ':', None, ':', 23.8, '', 39.3, ''),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'ES', None, ':', None, ':', 130.0, '', 122.2, ''),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'AT', None, ':', None, ':', 0.0, '', 0.0, ''),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'BE', None, ':', None, ':', 23.8, '', 39.3, ''),
 ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'ES', None, ':', None, ':', 130.0, '', 122.2, '')]
```

#### Example: Download a subset of data from a dataset without flags as list of tuples

To download a subset, you need to set the *filter_pars* dictionary.
Its keys can be: *'startPeriod'*, *'endPeriod'* and any parameter you get with *eurostat.get_pars()*.
Values can be number, string or list and generally are derived by *eurostat.get_par_values()*.

```python
>>> import eurostat
>>> code = 'GOV_10DD_SLGD'
>>> pars = eurostat.get_pars(code)
>>> pars
['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']
>>> par_values = eurostat.get_par_values(code, 'geo')
>>> par_values
['BE', 'DE', 'ES', 'AT']
>>> my_filter_pars = {'startPeriod': 2019, 'geo': ['AT','BE']}
>>> data = eurostat.get_data(code, filter_pars=my_filter_pars)
>>> data[0]
('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\TIME_PERIOD', 2019, 2020, 2021)
>>> data[445:447]
[('A', 'GD', 'S1_S2', 'Y_LT1', 'PC_TOT', 'AT', None, 1.0, 0.9),
 ('A', 'F22', 'S1_S2', 'TOTAL', 'MIO_EUR', 'BE', None, 0.0, 0.0)]
```

#### Example: Download a subset of data from a dataset with flags as list of tuples

```python
>>> import eurostat
>>> code = 'GOV_10DD_SLGD'
>>> pars = eurostat.get_pars(code)
>>> pars
['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']
>>> par_values = eurostat.get_par_values(code, 'geo')
>>> par_values
['BE', 'DE', 'ES', 'AT']
>>> my_filter_pars = {'startPeriod': 2019, 'geo': ['AT','BE']}
>>> data = eurostat.get_data(code, True, filter_pars=my_filter_pars)
>>> data[0]
('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\TIME_PERIOD', '2019_value', '2019_flag', '2020_value', '2020_flag', '2021_value', '2021_flag')
>>> data[446:448]
[('A', 'GD', 'S1_S2', 'Y_LT1', 'PC_TOT', 'AT', None, ':', 1.0, '', 0.9, ''),
 ('A', 'F22', 'S1_S2', 'TOTAL', 'MIO_EUR', 'BE', None, ':', 0.0, '', 0.0, '')]
```

### As a pandas dataframe:

```python
eurostat.get_data_df(code, [flags=False], [filter_pars=None], [verbose=False], [reverse_time=False])
```

Read an Eurostat dataset and returns it as pandas dataframe.

To get a subset, set *filter_pars* (a dictionary where keys are parameter names, values are the wanted items).

To see a rough progress status, set *verbose=True*.

*flag=True* downloads also the flags associated to the data.
Pay attention: the data format changes if *flags* is *True* or not.
Flag meanings can be found [here][abbr].

*reverse_time=True* reverses the order of the time columns. For compatibility with 0.x.x versions.

#### Example: Full download a dataset without flags as pandas dataframe
 
```python
>>> import eurostat
>>> data = eurostat.get_data_df('GOV_10DD_SLGD')
>>> data
     freq na_item sector maturity  ... 2018 2019    2020    2021
0       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0
1       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0
2       A     F22  S1_S2    TOTAL  ...  0.0  0.0     0.0     0.0
3       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0
4       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0
  ...     ...    ...      ...  ...  ...  ...     ...     ...
1181    A      GD  S1_S2    Y_LT1  ...  NaN  NaN  2849.0  2408.2
1182    A      GD  S1_S2    Y_LT1  ...  NaN  NaN     1.0     0.9
1183    A      GD  S1_S2    Y_LT1  ...  NaN  NaN     6.9     5.4
1184    A      GD  S1_S2    Y_LT1  ...  4.9  6.0     5.9     5.5
1185    A      GD  S1_S2    Y_LT1  ...  NaN  NaN     0.9     0.8
```

#### Example: Full download a dataset with flags as pandas dataframe
 
```python
>>> import eurostat
>>> data = eurostat.get_data_df('GOV_10DD_SLGD', True)
>>> data
     freq na_item sector maturity  ... 2020_value 2020_flag  2021_value 2021_flag
0       A     F22  S1_S2    TOTAL  ...        0.0         :         0.0          
1       A     F22  S1_S2    TOTAL  ...        0.0                   0.0          
2       A     F22  S1_S2    TOTAL  ...        0.0         :         0.0          
3       A     F22  S1_S2    TOTAL  ...        0.0                   0.0          
4       A     F22  S1_S2    TOTAL  ...        0.0                   0.0          
  ...     ...    ...      ...  ...        ...       ...         ...       ...
1182    A      GD  S1_S2    Y_LT1  ...        1.0                   0.9          
1183    A      GD  S1_S2    Y_LT1  ...        6.9                   5.4          
1184    A      GD  S1_S2    Y_LT1  ...        5.9                   5.5          
1185    A      GD  S1_S2    Y_LT1  ...        0.9         :         0.8          
1186    A      GD  S1_S2    Y_LT1  ...        0.9                   0.8          
```

#### Example: Download a subset of data from a dataset without flags as pandas dataframe

To download a subset, you need to set the *filter_pars* dictionary.
Its keys can be: *'startPeriod'*, *'endPeriod'* and any parameter you get with *eurostat.get_pars()*.
Values can be number, string or list and generally are derived by *eurostat.get_par_values()*.

```python
>>> import eurostat
>>> code = 'GOV_10DD_SLGD'
>>> pars = eurostat.get_pars(code)
>>> pars
['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']
>>> par_values = eurostat.get_par_values(code, 'geo')
>>> par_values
['BE', 'DE', 'ES', 'AT']
>>> my_filter_pars = {'endPeriod': 2020, 'geo': ['AT','BE']}
>>> data = eurostat.get_data_df(code, filter_pars=my_filter_pars)
>>> data
    freq na_item sector maturity     unit geo\TIME_PERIOD  2018  2019     2020
0      A     F22  S1_S2    TOTAL  MIO_EUR              AT   NaN   NaN      0.0
1      A     F22  S1_S2    TOTAL  MIO_NAC              AT   NaN   NaN      0.0
2      A     F22  S1_S2    Y_LT1  MIO_EUR              AT   NaN   NaN      0.0
3      A     F22  S1_S2    Y_LT1  MIO_NAC              AT   NaN   NaN      0.0
4      A     F29  S1_S2    TOTAL  MIO_EUR              AT   NaN   NaN      0.0
..   ...     ...    ...      ...      ...             ...   ...   ...      ...
633    A      GD  S1_S2    Y_GT1  MIO_NAC              BE   NaN   NaN  72660.0
634    A      GD  S1_S2    Y_GT1   PC_TOT              BE   NaN   NaN     93.1
635    A      GD  S1_S2    Y_LT1  MIO_EUR              BE   NaN   NaN   5387.0
636    A      GD  S1_S2    Y_LT1  MIO_NAC              BE   NaN   NaN   5387.0
637    A      GD  S1_S2    Y_LT1   PC_TOT              BE   NaN   NaN      6.9
```

#### Example: Download a subset of data from a dataset with flags as pandas dataframe

```python
>>> import eurostat
>>> code = 'GOV_10DD_SLGD'
>>> pars = eurostat.get_pars(code)
>>> pars
['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']
>>> par_values = eurostat.get_par_values(code, 'geo')
>>> par_values
['BE', 'DE', 'ES', 'AT']
>>> my_filter_pars = {'endPeriod': 2020, 'geo': ['AT','BE']}
>>> data = eurostat.get_data_df(code, True, filter_pars=my_filter_pars)
>>> data
    freq na_item sector maturity  ... 2019_value 2019_flag  2020_value 2020_flag
0      A     F22  S1_S2    TOTAL  ...        NaN         :         0.0          
1      A     F22  S1_S2    TOTAL  ...        NaN         :         0.0          
2      A     F22  S1_S2    Y_LT1  ...        NaN         :         0.0          
3      A     F22  S1_S2    Y_LT1  ...        NaN         :         0.0          
4      A     F29  S1_S2    TOTAL  ...        NaN         :         0.0          
..   ...     ...    ...      ...  ...        ...       ...         ...       ...
635    A      GD  S1_S2    Y_GT1  ...        NaN         :        93.1          
636    A      GD  S1_S2    Y_LT1  ...        NaN         :      5387.0          
637    A      GD  S1_S2    Y_LT1  ...        NaN         :      5387.0          
638    A      GD  S1_S2    Y_LT1  ...        NaN         :         6.9          
639    A      GD  S1_S2    Y_LT1  ...        NaN         :         6.9          
```

## In case you need to use a proxy:

You can configure the https proxy with *setproxy*, or with *set_requests_args* (the latter is described in the next section).

```python
eurostat.setproxy(proxyinfo)
```

It requires in input *proxyinfo*, a dictionary with one key (*'https'*) and value containing the connection parameters in a list.  
If authentication is not needed, set *username* and *password* to *None*.

It overwrites the proxy setting of any previous runs of *set_requests_args*.

For the Eurostat API, only the https proxy is used.

#### Example:

```python
>>> import eurostat
>>> proxyinfo = {'https': ['myuser', 'mypassword', 'http://url:port']}
>>> eurostat.setproxy(proxyinfo)
```

It always returns *None*.
If you want to see your setting, use the function *get_requests_args*.


## In case you need to configure the request:

You may need to modify the default download settings.
The Eurostat package uses the [requests][req] package and allows to set some of its arguments:

* *timeout*: how long to wait for the server before raising an error, in sec. Default is 120 sec.
* *proxies* : sets the proxies. It overwrites the proxy setting of any previous runs of *setproxy*. 
              For the Eurostat API, only the https proxy is used. Default is None (the optional argument is not passed to the request).
* *verify* : whether to verify the server’s TLS certificate, or to use a CA bundle. Defaults to None (the optional argument is not passed to the request). 
* *cert* : whether to use a SSL client cert file. Defaults to None (the optional argument is not passed to the request).

```python
eurostat.set_requests_args([timeout=120.], [proxies=None], [verify=None], [cert=None])
```

It returns *None*.

For detailed information, please refer to the documentation of the package [requests][req_req].

#### Example:

```python
>>> import eurostat
>>> mytimeout = 240.
>>> myproxy = {'https': 'http://myuser:mypass@123.45.67.89:1234'}
>>> eurostat.set_requests_args(timeout=mytimeout, proxies=myproxy)
```

To check the settings:

```python
eurostat.get_requests_args()
```

It returns a dictionary with the argument names and their respective values, exactly as they are passed to the request.


## Bug reports and feature requests:

After checking all the [issues][issues] online, please [open a new issue][issue] or send a message to noemi.cazzaniga [at] polimi.it .


## Disclaimer:

Download and usage of Eurostat data is subject to Eurostat's general copyright notice and licence policy (see [Policies][pol]). Please also be aware of the European Commission's [general conditions][cond].


## Data sources:

* Eurostat database: [online catalog][onlinecat].
* Eurostat classifications: [Access to classifications][clas].
* Eurostat Interactive Data Browser: [Data Browser][databrow].
* Eurostat Interactive Tool for Comext Data: [Easy Comext][comext].
* Eurostat PRODCOM website: [PRODCOM][prodcom].
* Eurostat acronyms: [Symbols and abbreviations][abbr].
* Eurostat web services description: [Web services][webserv].


## References:

* Python package [pandas][pd]: Python Data Analysis Library.
* Python package [requests][req]: HTTP Library for Python.
* R package [eurostat][es]: R Tools for Eurostat Open Data.


## History:

### version 1.1.1 (13 Jun 2024):

* Added the option for downloading the toc only for some agencies.
* Internal bug fix.

### version 1.1.0 (09 Mar 2024):

* Bug fix: async download.
* set_requests_args, get_requests_args added.
* get_dic gives also dims dictionary.
* Added dataframe output from get_dic.
* get_toc of single dataset.
* Enhanced localisation.

### version 1.0.4 (03 Apr 2023):

* Changed input of setproxy to read the full address.

### version 1.0.3 (30 Mar 2023):

* Bug fix: proxy setting.

### version 1.0.2 (14 Mar 2023):

* Bug fix: proxy setting. Deprecated.

### version 1.0.1 (12 Oct 2022):

* Bug fix (wheel for conda venv).

### version 1.0.0 (08 Oct 2022):

* Adapted to the new Eurostat API (SDMX 2.1).
* pandasdmx not required anymore.
* Error messages improved.
* Compiled also for conda install.
* Multilingual dictionary.

### version 0.2.3 (06 Apr 2021):

* Internal bug fix.

### version 0.2.2 (31 Mar 2021):

* Bug fix (sdmx non-annual data). Deprecated.

### version 0.2.1 (10 Nov 2020):

* Bug fix (pandasdmx 0.9).

### version 0.2.0 (22 May 2020):

* Improved SDMX download capability in case of slow internet connections.

### version 0.1.5 (08 Jan 2020):

* Bug fix (proxy info).
* get_avail_sdmx, get_avail_sdmx_df, subset_avail_sdmx_df added.

### version 0.1.4 (20 Dec 2019):

* Added support to proxy.

### version 0.1.3 (17 Dec 2019):

* Bug fix (non-annual data headers).

### version 0.1.2 (25 Nov 2019):

* Added possibility of downloading flags.
* get_toc_df, subset_toc_df added.

### version 0.1.1 (21 Nov 2019):

* First official release.


[pol]: https://ec.europa.eu/eurostat/about/policies/copyright
[cond]: http://ec.europa.eu/geninfo/legal_notices_en.htm
[onlinecat]: https://ec.europa.eu/eurostat/data/database
[clas]: https://ec.europa.eu/eurostat/web/metadata/classifications
[databrow]: https://ec.europa.eu/eurostat/databrowser/
[pd]: https://pandas.pydata.org/
[es]: http://ropengov.github.io/eurostat/
[issues]: https://bitbucket.org/noemicazzaniga/eurostat/issues
[issue]: https://bitbucket.org/noemicazzaniga/eurostat/issues/new
[abbr]: https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Tutorial:Symbols_and_abbreviations#Statistical_symbols.2C_abbreviations_and_units_of_measurement
[prodcom]: https://ec.europa.eu/eurostat/web/prodcom
[comext]: https://ec.europa.eu/eurostat/comext/newxtweb/
[webserv]: https://ec.europa.eu/eurostat/web/main/data/web-services
[condapack]: https://anaconda.org/noemicazzaniga/eurostat
[req]: https://requests.readthedocs.io/en/latest/
[req_req]: https://requests.readthedocs.io/en/latest/api/#requests.Session.request

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "eurostat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "eurostat comext prodcom statistics data economics science",
    "author": "Noemi Emanuela Cazzaniga",
    "author_email": "noemi.cazzaniga@polimi.it",
    "download_url": "https://files.pythonhosted.org/packages/c8/f0/5ef71bc8983335f509170f28a3e4c5ef5a6cbe4c42232e341383746f0ccf/eurostat-1.1.1.tar.gz",
    "platform": null,
    "description": "# Eurostat Python Package\r\n\r\nTools to read data from Eurostat API.\r\n\r\n\r\n# Features\r\n\r\n* Read Eurostat data and metadata as list of tuples or as pandas dataframe.\r\n* Use the new SDMX 2.1 Eurostat web services.\r\n* Download data from Eurostat, COMEXT, DG COMP, DG EMPL, DG GROW.\r\n* Available from both pip and [conda][condapack]. \r\n* MIT license.\r\n\r\n\r\n# Important!\r\n\r\nFrom version 1.0.0, this package implements MAJOR CHANGES.\r\n\r\nThe previous official Eurostat API, used by the older releases of this Python package, is supposed to be decommissioned in January 2023.\r\nIt has been replaced with a new dissemination API.\r\nThis forced to rewrite this Python package, almost completely.\r\n\r\nI have done my best to make the new Eurostat Python package compatible with the old releases.\r\nNevertheless, you may see some differences, also in the output format.\r\n\r\nThe main differences are in the SDMX functions.\r\nIn particular, OBS_STATUS is no more provided by the API.\r\nIt is replaced by a flag, that has different symbols and meanings.\r\nFrom version 1.0.0, the SDMX functions of the Eurostat Python package are deprecated, but temporarily kept available.\r\nThese functions will be removed from version 2.0.0 of the Eurostat Python package.\r\nThey always print an alert message, that can be \"muted\" by setting the argument *noalert=True*.\r\n\r\n\r\n# Documentation\r\n\r\n\r\n## Getting started:\r\n\r\nRequires Python 3.5+\r\n\r\n```bash\r\npip install eurostat\r\n```\r\n\r\n\r\n## Read the table of contents of the Eurostat database:\r\n\r\n### As a list of tuples:\r\n\r\n```python\r\neurostat.get_toc([agency='all'], [dataset='all'], [lang='en'])\r\n```\r\n\r\nRead the table of contents and return a list of tuples. The first element of the list contains the header line. Dates are represented as strings.\r\n\r\n*agency* allows to download only the table of contents of some agencies. They can be provided as a list or as a string, if only one agency is wanted.\r\nAllowed agencies are: 'EUROSTAT', 'COMEXT', 'COMP', 'EMPL', 'GROW'.\r\n\r\n*lang* allows to download the table of contents in one of the following languages: *'en'*=English, *'fr'*=French, *'de'*=German, when provided by Eurostat. Default is English.\r\n\r\nIf you want to get only the metadata of one dataset, set *dataset=code*, e.g. *dataset='MET_10R_3EMP'*.\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> import eurostat\r\n>>> toc = eurostat.get_toc()\r\n>>> toc[0]\r\n('title', 'code', 'type', 'last update of data', 'last table structure change', 'data start', 'data end')\r\n>>> toc[12:15]\r\n[('Employment by NACE Rev. 2 activity and metropolitan typology', 'MET_10R_3EMP', 'dataset', '2022-05-06T23:00:00+0200', '2022-05-06T23:00:00+0200', '1995', '2020'),\r\n ('Gross domestic product (GDP) at current market prices by metropolitan regions', 'MET_10R_3GDP', 'dataset', '2022-04-21T23:00:00+0200', '2022-04-21T23:00:00+0200', '2000', '2020'),\r\n ('Gross value added at basic prices by metropolitan regions', 'MET_10R_3GVA', 'dataset', '2022-04-21T23:00:00+0200', '2022-04-21T23:00:00+0200', '1995', '2020')]\r\n```\r\n\r\n### As a pandas dataframe:\r\n\r\n```python\r\neurostat.get_toc_df([agency='all'], [dataset='all'], [lang='en'])\r\n```\r\n\r\nRead the table of contents of the main database and return a dataframe.\r\n\r\n*agency* allows to download only the table of contents of some agencies. They can be provided as a list or as a string, if only one agency is wanted.\r\nAllowed agencies are: 'EUROSTAT', 'COMEXT', 'COMP', 'EMPL', 'GROW'.\r\n\r\n*lang* allows to download the table of contents in one of the following languages: *\"en\"*=English, *\"fr\"*=French, *\"de\"*=German, when provided by Eurostat. Default is English.\r\n\r\nIf you want to get only the metadata of one dataset, set *dataset=code*, e.g. *dataset='MET_10R_3EMP'*.\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> import eurostat\r\n>>> toc_df = eurostat.get_toc_df()\r\n>>> toc_df\r\n                                                  title  ... data end\r\n0     Road equipment: number of road vehicles by cat...  ...     2018\r\n1        Road equipment: number of road vehicles by age  ...     2018\r\n2              Road equipment: load capacity of lorries  ...     2015\r\n3       Road equipment: new registrations by categories  ...     2015\r\n4        Road traffic: road freight transport in volume  ...     2018\r\n                                                ...  ...      ...\r\n7225  Tropical wood imports to the EU from chapter 4...  ...  2020-12\r\n7226  Candidate countries and potential candidates: ...  ...     2019\r\n7227  Candidate countries and potential candidates: ...  ...     2014\r\n7228  Candidate countries and potential candidates: ...  ...     2015\r\n7229  Candidate countries and potential candidates: ...  ...     2014\r\n```\r\n\r\nYou may also want to extract the datasets that pertain a topic. In that case, you can use:\r\n\r\n```python\r\neurostat.subset_toc_df(toc_df, keyword)\r\n```\r\n\r\nExtract from toc_df the rows where the column *title* contains *keyword* (case-insensitive).\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> f = eurostat.subset_toc_df(toc_df, 'fleet')\r\n>>> f\r\n                                                  title  ... data end\r\n4873                       Fishing fleet, total tonnage  ...     2021\r\n4895                   Fishing Fleet, Number of Vessels  ...     2021\r\n6169  Commercial aircraft fleet by age of aircraft a...  ...     2020\r\n6172  Commercial aircraft fleet by age of aircraft a...  ...     2020\r\n6175  Commercial aircraft fleet by aircraft category...  ...     2020\r\n6178  Commercial aircraft fleet by aircraft category...  ...     2020\r\n6576      Commercial aircraft fleet by type of aircraft  ...     2020\r\n7120     Fishing fleet by age, length and gross tonnage  ...     2021\r\n7121     Fishing fleet by type of gear and engine power  ...     2021\r\n```\r\n\r\n\r\n## Get the filter parameters to download a subset of a dataset:\r\n\r\n```python\r\neurostat.get_pars(code)\r\n```\r\n\r\nRead the parameter names that can be filtered for a given dataset *code* and return them as a list.\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> import eurostat\r\n>>> pars = eurostat.get_pars('demo_r_d2jan')\r\n>>> pars\r\n['freq', 'unit', 'sex', 'age', 'geo']\r\n```\r\n\r\nFrom the example, you can note that *code* is generally case-insensitive.\r\n\r\nTo get the parameter values for filtering, you can use:\r\n\r\n```python\r\neurostat.get_par_values(code, par)\r\n```\r\n\r\nRead the values of a given parameter *par* that can be found in a given dataset *code*.\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> import eurostat\r\n>>> par_values = eurostat.get_par_values('demo_r_d2jan', 'sex')\r\n>>> par_values\r\n['T', 'M', 'F']\r\n```\r\n\r\n\r\n## Get an Eurostat dictionary:\r\n\r\n```python\r\neurostat.get_dic(code, [par=None], [full=True], [frmt=\"list\"], [lang=\"en\"])\r\n```\r\n\r\nRead the dictionary with the descriptions of the parameters (dimensions) of a dataset if *par =None* or\r\nthe descriptions of the values of a given parameter *par*, as a dataframe, a list of tuples or as a dictionary.\r\n\r\nIf you want the full list of possible values of *par*, set *full=True*, while *full=False* returns only the values that are in the given dataset, output from *get_par_values()*.\r\nDefault is *full=True*.\r\n\r\n*frmt=\"list\"* makes the function return a list of tuples without header.\r\nFor the dictionary of the parameters, the first element of each tuple is the parameter code, the second is its name, and the third is its description (when provided).\r\nFor the dictionary of the parameter values, the first element of each tuple is the code value and the second one is its description.\r\nSet *frmt=\"df\"* to get a dataframe as output.\r\nIf *frmt=\"dict\"* it returns a dictionary.\r\nDefault is *frmt=\"list\"*.\r\n\r\n*lang* allows to download the dictionary in one of the following languages: *\"en\"*=English, *\"fr\"*=French, *\"de\"*=German, when provided by Eurostat. Default is English.\r\n\r\n\r\n#### Example: Get the dictionary of the parameters of a dataset as a list of tuples\r\n\r\n```python\r\n>>> import eurostat\r\n>>> dic = eurostat.get_dic('demo_r_d2jan')\r\n>>> dic\r\n[('freq', 'Time frequency', 'This code list contains the periodicity that refers to the frequency.'),\r\n ('unit', 'Unit of measure', None),\r\n ('sex', 'Sex', 'This code list provides information about the state of being male or female and refers ...'),\r\n ('age', 'Age class', 'This code list contains periods of time, i.e. the length of time that a person or ...'),\r\n ('geo', 'Geopolitical entity (reporting)', 'This code list defines the reporting geopolitical entities.')]\r\n```\r\n\r\n#### Example: Get the dictionary of the the parameter values of a dataset as a dataframe\r\n\r\n```python\r\n>>> import eurostat\r\n>>> dic = eurostat.get_dic('demo_r_d2jan', 'sex', frmt='df')\r\n>>> dic\r\n    val                                          descr\r\n0     T                                          Total\r\n1     M                                          Males\r\n2     F                                        Females\r\n3  DIFF  Absolute difference between males and females\r\n4   NAP                                 Not applicable\r\n5   NRP                                    No response\r\n6   UNK                                        Unknown\r\n```\r\n\r\n\r\n\r\n## Read a dataset:\r\n\r\n### As a list of tuples:\r\n\r\n```python\r\neurostat.get_data(code, [flags=False], [filter_pars=dict()], [verbose=False], [reverse_time=False])\r\n```\r\n\r\nRead an Eurostat dataset and returns it as a list of tuples.\r\nThe first element of the list (\"the first row\") is the data header.\r\n\r\nTo get a subset, set *filter_pars* (a dictionary where keys are parameter names, values are the wanted items).\r\n\r\nTo see a rough progress status, set *verbose=True*.\r\n\r\n*flag=True* downloads also the flags associated to the data.\r\nPay attention: the data format changes if *flags* is *True* or not.\r\nFlag meanings can be found [here][abbr].\r\n\r\n*reverse_time=True* reverses the order of the time columns. For compatibility with 0.x.x versions.\r\n\r\n#### Example: Full download a dataset without flags as list of tuples\r\n \r\n```python\r\n>>> import eurostat\r\n>>> data = eurostat.get_data('GOV_10DD_SLGD')\r\n>>> data[0]\r\n('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\\\TIME_PERIOD', 2018, 2019, 2020, 2021)\r\n>>> data[90:95]\r\n[('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'BE', None, None, 23.8, 39.3),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'ES', None, None, 130.0, 122.2),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'AT', None, None, 0.0, 0.0),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'BE', None, None, 23.8, 39.3),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'ES', None, None, 130.0, 122.2)]\r\n```\r\n\r\n#### Example: Full download a dataset with flags as list of tuples\r\n \r\n```python\r\n>>> import eurostat\r\n>>> data = eurostat.get_data('GOV_10DD_SLGD', True)\r\n>>> data[0]\r\n('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\\\TIME_PERIOD', '2018_value', '2018_flag', '2019_value', '2019_flag', '2020_value', '2020_flag', '2021_value', '2021_flag')\r\n>>> data[90:95]\r\n[('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'BE', None, ':', None, ':', 23.8, '', 39.3, ''),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_EUR', 'ES', None, ':', None, ':', 130.0, '', 122.2, ''),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'AT', None, ':', None, ':', 0.0, '', 0.0, ''),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'BE', None, ':', None, ':', 23.8, '', 39.3, ''),\r\n ('A', 'F3', 'S11', 'TOTAL', 'MIO_NAC', 'ES', None, ':', None, ':', 130.0, '', 122.2, '')]\r\n```\r\n\r\n#### Example: Download a subset of data from a dataset without flags as list of tuples\r\n\r\nTo download a subset, you need to set the *filter_pars* dictionary.\r\nIts keys can be: *'startPeriod'*, *'endPeriod'* and any parameter you get with *eurostat.get_pars()*.\r\nValues can be number, string or list and generally are derived by *eurostat.get_par_values()*.\r\n\r\n```python\r\n>>> import eurostat\r\n>>> code = 'GOV_10DD_SLGD'\r\n>>> pars = eurostat.get_pars(code)\r\n>>> pars\r\n['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']\r\n>>> par_values = eurostat.get_par_values(code, 'geo')\r\n>>> par_values\r\n['BE', 'DE', 'ES', 'AT']\r\n>>> my_filter_pars = {'startPeriod': 2019, 'geo': ['AT','BE']}\r\n>>> data = eurostat.get_data(code, filter_pars=my_filter_pars)\r\n>>> data[0]\r\n('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\\\TIME_PERIOD', 2019, 2020, 2021)\r\n>>> data[445:447]\r\n[('A', 'GD', 'S1_S2', 'Y_LT1', 'PC_TOT', 'AT', None, 1.0, 0.9),\r\n ('A', 'F22', 'S1_S2', 'TOTAL', 'MIO_EUR', 'BE', None, 0.0, 0.0)]\r\n```\r\n\r\n#### Example: Download a subset of data from a dataset with flags as list of tuples\r\n\r\n```python\r\n>>> import eurostat\r\n>>> code = 'GOV_10DD_SLGD'\r\n>>> pars = eurostat.get_pars(code)\r\n>>> pars\r\n['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']\r\n>>> par_values = eurostat.get_par_values(code, 'geo')\r\n>>> par_values\r\n['BE', 'DE', 'ES', 'AT']\r\n>>> my_filter_pars = {'startPeriod': 2019, 'geo': ['AT','BE']}\r\n>>> data = eurostat.get_data(code, True, filter_pars=my_filter_pars)\r\n>>> data[0]\r\n('freq', 'na_item', 'sector', 'maturity', 'unit', 'geo\\\\TIME_PERIOD', '2019_value', '2019_flag', '2020_value', '2020_flag', '2021_value', '2021_flag')\r\n>>> data[446:448]\r\n[('A', 'GD', 'S1_S2', 'Y_LT1', 'PC_TOT', 'AT', None, ':', 1.0, '', 0.9, ''),\r\n ('A', 'F22', 'S1_S2', 'TOTAL', 'MIO_EUR', 'BE', None, ':', 0.0, '', 0.0, '')]\r\n```\r\n\r\n### As a pandas dataframe:\r\n\r\n```python\r\neurostat.get_data_df(code, [flags=False], [filter_pars=None], [verbose=False], [reverse_time=False])\r\n```\r\n\r\nRead an Eurostat dataset and returns it as pandas dataframe.\r\n\r\nTo get a subset, set *filter_pars* (a dictionary where keys are parameter names, values are the wanted items).\r\n\r\nTo see a rough progress status, set *verbose=True*.\r\n\r\n*flag=True* downloads also the flags associated to the data.\r\nPay attention: the data format changes if *flags* is *True* or not.\r\nFlag meanings can be found [here][abbr].\r\n\r\n*reverse_time=True* reverses the order of the time columns. For compatibility with 0.x.x versions.\r\n\r\n#### Example: Full download a dataset without flags as pandas dataframe\r\n \r\n```python\r\n>>> import eurostat\r\n>>> data = eurostat.get_data_df('GOV_10DD_SLGD')\r\n>>> data\r\n     freq na_item sector maturity  ... 2018 2019    2020    2021\r\n0       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0\r\n1       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0\r\n2       A     F22  S1_S2    TOTAL  ...  0.0  0.0     0.0     0.0\r\n3       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0\r\n4       A     F22  S1_S2    TOTAL  ...  NaN  NaN     0.0     0.0\r\n  ...     ...    ...      ...  ...  ...  ...     ...     ...\r\n1181    A      GD  S1_S2    Y_LT1  ...  NaN  NaN  2849.0  2408.2\r\n1182    A      GD  S1_S2    Y_LT1  ...  NaN  NaN     1.0     0.9\r\n1183    A      GD  S1_S2    Y_LT1  ...  NaN  NaN     6.9     5.4\r\n1184    A      GD  S1_S2    Y_LT1  ...  4.9  6.0     5.9     5.5\r\n1185    A      GD  S1_S2    Y_LT1  ...  NaN  NaN     0.9     0.8\r\n```\r\n\r\n#### Example: Full download a dataset with flags as pandas dataframe\r\n \r\n```python\r\n>>> import eurostat\r\n>>> data = eurostat.get_data_df('GOV_10DD_SLGD', True)\r\n>>> data\r\n     freq na_item sector maturity  ... 2020_value 2020_flag  2021_value 2021_flag\r\n0       A     F22  S1_S2    TOTAL  ...        0.0         :         0.0          \r\n1       A     F22  S1_S2    TOTAL  ...        0.0                   0.0          \r\n2       A     F22  S1_S2    TOTAL  ...        0.0         :         0.0          \r\n3       A     F22  S1_S2    TOTAL  ...        0.0                   0.0          \r\n4       A     F22  S1_S2    TOTAL  ...        0.0                   0.0          \r\n  ...     ...    ...      ...  ...        ...       ...         ...       ...\r\n1182    A      GD  S1_S2    Y_LT1  ...        1.0                   0.9          \r\n1183    A      GD  S1_S2    Y_LT1  ...        6.9                   5.4          \r\n1184    A      GD  S1_S2    Y_LT1  ...        5.9                   5.5          \r\n1185    A      GD  S1_S2    Y_LT1  ...        0.9         :         0.8          \r\n1186    A      GD  S1_S2    Y_LT1  ...        0.9                   0.8          \r\n```\r\n\r\n#### Example: Download a subset of data from a dataset without flags as pandas dataframe\r\n\r\nTo download a subset, you need to set the *filter_pars* dictionary.\r\nIts keys can be: *'startPeriod'*, *'endPeriod'* and any parameter you get with *eurostat.get_pars()*.\r\nValues can be number, string or list and generally are derived by *eurostat.get_par_values()*.\r\n\r\n```python\r\n>>> import eurostat\r\n>>> code = 'GOV_10DD_SLGD'\r\n>>> pars = eurostat.get_pars(code)\r\n>>> pars\r\n['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']\r\n>>> par_values = eurostat.get_par_values(code, 'geo')\r\n>>> par_values\r\n['BE', 'DE', 'ES', 'AT']\r\n>>> my_filter_pars = {'endPeriod': 2020, 'geo': ['AT','BE']}\r\n>>> data = eurostat.get_data_df(code, filter_pars=my_filter_pars)\r\n>>> data\r\n    freq na_item sector maturity     unit geo\\TIME_PERIOD  2018  2019     2020\r\n0      A     F22  S1_S2    TOTAL  MIO_EUR              AT   NaN   NaN      0.0\r\n1      A     F22  S1_S2    TOTAL  MIO_NAC              AT   NaN   NaN      0.0\r\n2      A     F22  S1_S2    Y_LT1  MIO_EUR              AT   NaN   NaN      0.0\r\n3      A     F22  S1_S2    Y_LT1  MIO_NAC              AT   NaN   NaN      0.0\r\n4      A     F29  S1_S2    TOTAL  MIO_EUR              AT   NaN   NaN      0.0\r\n..   ...     ...    ...      ...      ...             ...   ...   ...      ...\r\n633    A      GD  S1_S2    Y_GT1  MIO_NAC              BE   NaN   NaN  72660.0\r\n634    A      GD  S1_S2    Y_GT1   PC_TOT              BE   NaN   NaN     93.1\r\n635    A      GD  S1_S2    Y_LT1  MIO_EUR              BE   NaN   NaN   5387.0\r\n636    A      GD  S1_S2    Y_LT1  MIO_NAC              BE   NaN   NaN   5387.0\r\n637    A      GD  S1_S2    Y_LT1   PC_TOT              BE   NaN   NaN      6.9\r\n```\r\n\r\n#### Example: Download a subset of data from a dataset with flags as pandas dataframe\r\n\r\n```python\r\n>>> import eurostat\r\n>>> code = 'GOV_10DD_SLGD'\r\n>>> pars = eurostat.get_pars(code)\r\n>>> pars\r\n['freq', 'na_item', 'sector', 'maturity', 'unit', 'geo']\r\n>>> par_values = eurostat.get_par_values(code, 'geo')\r\n>>> par_values\r\n['BE', 'DE', 'ES', 'AT']\r\n>>> my_filter_pars = {'endPeriod': 2020, 'geo': ['AT','BE']}\r\n>>> data = eurostat.get_data_df(code, True, filter_pars=my_filter_pars)\r\n>>> data\r\n    freq na_item sector maturity  ... 2019_value 2019_flag  2020_value 2020_flag\r\n0      A     F22  S1_S2    TOTAL  ...        NaN         :         0.0          \r\n1      A     F22  S1_S2    TOTAL  ...        NaN         :         0.0          \r\n2      A     F22  S1_S2    Y_LT1  ...        NaN         :         0.0          \r\n3      A     F22  S1_S2    Y_LT1  ...        NaN         :         0.0          \r\n4      A     F29  S1_S2    TOTAL  ...        NaN         :         0.0          \r\n..   ...     ...    ...      ...  ...        ...       ...         ...       ...\r\n635    A      GD  S1_S2    Y_GT1  ...        NaN         :        93.1          \r\n636    A      GD  S1_S2    Y_LT1  ...        NaN         :      5387.0          \r\n637    A      GD  S1_S2    Y_LT1  ...        NaN         :      5387.0          \r\n638    A      GD  S1_S2    Y_LT1  ...        NaN         :         6.9          \r\n639    A      GD  S1_S2    Y_LT1  ...        NaN         :         6.9          \r\n```\r\n\r\n## In case you need to use a proxy:\r\n\r\nYou can configure the https proxy with *setproxy*, or with *set_requests_args* (the latter is described in the next section).\r\n\r\n```python\r\neurostat.setproxy(proxyinfo)\r\n```\r\n\r\nIt requires in input *proxyinfo*, a dictionary with one key (*'https'*) and value containing the connection parameters in a list.  \r\nIf authentication is not needed, set *username* and *password* to *None*.\r\n\r\nIt overwrites the proxy setting of any previous runs of *set_requests_args*.\r\n\r\nFor the Eurostat API, only the https proxy is used.\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> import eurostat\r\n>>> proxyinfo = {'https': ['myuser', 'mypassword', 'http://url:port']}\r\n>>> eurostat.setproxy(proxyinfo)\r\n```\r\n\r\nIt always returns *None*.\r\nIf you want to see your setting, use the function *get_requests_args*.\r\n\r\n\r\n## In case you need to configure the request:\r\n\r\nYou may need to modify the default download settings.\r\nThe Eurostat package uses the [requests][req] package and allows to set some of its arguments:\r\n\r\n* *timeout*: how long to wait for the server before raising an error, in sec. Default is 120 sec.\r\n* *proxies* : sets the proxies. It overwrites the proxy setting of any previous runs of *setproxy*. \r\n              For the Eurostat API, only the https proxy is used. Default is None (the optional argument is not passed to the request).\r\n* *verify* : whether to verify the server\u2019s TLS certificate, or to use a CA bundle. Defaults to None (the optional argument is not passed to the request). \r\n* *cert* : whether to use a SSL client cert file. Defaults to None (the optional argument is not passed to the request).\r\n\r\n```python\r\neurostat.set_requests_args([timeout=120.], [proxies=None], [verify=None], [cert=None])\r\n```\r\n\r\nIt returns *None*.\r\n\r\nFor detailed information, please refer to the documentation of the package [requests][req_req].\r\n\r\n#### Example:\r\n\r\n```python\r\n>>> import eurostat\r\n>>> mytimeout = 240.\r\n>>> myproxy = {'https': 'http://myuser:mypass@123.45.67.89:1234'}\r\n>>> eurostat.set_requests_args(timeout=mytimeout, proxies=myproxy)\r\n```\r\n\r\nTo check the settings:\r\n\r\n```python\r\neurostat.get_requests_args()\r\n```\r\n\r\nIt returns a dictionary with the argument names and their respective values, exactly as they are passed to the request.\r\n\r\n\r\n## Bug reports and feature requests:\r\n\r\nAfter checking all the [issues][issues] online, please [open a new issue][issue] or send a message to noemi.cazzaniga [at] polimi.it .\r\n\r\n\r\n## Disclaimer:\r\n\r\nDownload and usage of Eurostat data is subject to Eurostat's general copyright notice and licence policy (see [Policies][pol]). Please also be aware of the European Commission's [general conditions][cond].\r\n\r\n\r\n## Data sources:\r\n\r\n* Eurostat database: [online catalog][onlinecat].\r\n* Eurostat classifications: [Access to classifications][clas].\r\n* Eurostat Interactive Data Browser: [Data Browser][databrow].\r\n* Eurostat Interactive Tool for Comext Data: [Easy Comext][comext].\r\n* Eurostat PRODCOM website: [PRODCOM][prodcom].\r\n* Eurostat acronyms: [Symbols and abbreviations][abbr].\r\n* Eurostat web services description: [Web services][webserv].\r\n\r\n\r\n## References:\r\n\r\n* Python package [pandas][pd]: Python Data Analysis Library.\r\n* Python package [requests][req]: HTTP Library for Python.\r\n* R package [eurostat][es]: R Tools for Eurostat Open Data.\r\n\r\n\r\n## History:\r\n\r\n### version 1.1.1 (13 Jun 2024):\r\n\r\n* Added the option for downloading the toc only for some agencies.\r\n* Internal bug fix.\r\n\r\n### version 1.1.0 (09 Mar 2024):\r\n\r\n* Bug fix: async download.\r\n* set_requests_args, get_requests_args added.\r\n* get_dic gives also dims dictionary.\r\n* Added dataframe output from get_dic.\r\n* get_toc of single dataset.\r\n* Enhanced localisation.\r\n\r\n### version 1.0.4 (03 Apr 2023):\r\n\r\n* Changed input of setproxy to read the full address.\r\n\r\n### version 1.0.3 (30 Mar 2023):\r\n\r\n* Bug fix: proxy setting.\r\n\r\n### version 1.0.2 (14 Mar 2023):\r\n\r\n* Bug fix: proxy setting. Deprecated.\r\n\r\n### version 1.0.1 (12 Oct 2022):\r\n\r\n* Bug fix (wheel for conda venv).\r\n\r\n### version 1.0.0 (08 Oct 2022):\r\n\r\n* Adapted to the new Eurostat API (SDMX 2.1).\r\n* pandasdmx not required anymore.\r\n* Error messages improved.\r\n* Compiled also for conda install.\r\n* Multilingual dictionary.\r\n\r\n### version 0.2.3 (06 Apr 2021):\r\n\r\n* Internal bug fix.\r\n\r\n### version 0.2.2 (31 Mar 2021):\r\n\r\n* Bug fix (sdmx non-annual data). Deprecated.\r\n\r\n### version 0.2.1 (10 Nov 2020):\r\n\r\n* Bug fix (pandasdmx 0.9).\r\n\r\n### version 0.2.0 (22 May 2020):\r\n\r\n* Improved SDMX download capability in case of slow internet connections.\r\n\r\n### version 0.1.5 (08 Jan 2020):\r\n\r\n* Bug fix (proxy info).\r\n* get_avail_sdmx, get_avail_sdmx_df, subset_avail_sdmx_df added.\r\n\r\n### version 0.1.4 (20 Dec 2019):\r\n\r\n* Added support to proxy.\r\n\r\n### version 0.1.3 (17 Dec 2019):\r\n\r\n* Bug fix (non-annual data headers).\r\n\r\n### version 0.1.2 (25 Nov 2019):\r\n\r\n* Added possibility of downloading flags.\r\n* get_toc_df, subset_toc_df added.\r\n\r\n### version 0.1.1 (21 Nov 2019):\r\n\r\n* First official release.\r\n\r\n\r\n[pol]: https://ec.europa.eu/eurostat/about/policies/copyright\r\n[cond]: http://ec.europa.eu/geninfo/legal_notices_en.htm\r\n[onlinecat]: https://ec.europa.eu/eurostat/data/database\r\n[clas]: https://ec.europa.eu/eurostat/web/metadata/classifications\r\n[databrow]: https://ec.europa.eu/eurostat/databrowser/\r\n[pd]: https://pandas.pydata.org/\r\n[es]: http://ropengov.github.io/eurostat/\r\n[issues]: https://bitbucket.org/noemicazzaniga/eurostat/issues\r\n[issue]: https://bitbucket.org/noemicazzaniga/eurostat/issues/new\r\n[abbr]: https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Tutorial:Symbols_and_abbreviations#Statistical_symbols.2C_abbreviations_and_units_of_measurement\r\n[prodcom]: https://ec.europa.eu/eurostat/web/prodcom\r\n[comext]: https://ec.europa.eu/eurostat/comext/newxtweb/\r\n[webserv]: https://ec.europa.eu/eurostat/web/main/data/web-services\r\n[condapack]: https://anaconda.org/noemicazzaniga/eurostat\r\n[req]: https://requests.readthedocs.io/en/latest/\r\n[req_req]: https://requests.readthedocs.io/en/latest/api/#requests.Session.request\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Eurostat Python Package",
    "version": "1.1.1",
    "project_urls": {
        "Source": "https://bitbucket.org/noemicazzaniga/eurostat/src/master/"
    },
    "split_keywords": [
        "eurostat",
        "comext",
        "prodcom",
        "statistics",
        "data",
        "economics",
        "science"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51a051b4254341558a69002100e1bc9df436c000e03a1ae3488b7e431c61b890",
                "md5": "dfd2b4fd6504c37abb20fe990c8fa6e5",
                "sha256": "67297cbc5aeeded01cd48c18fe27ec6769658ebcafcf517758cf21f711faea11"
            },
            "downloads": -1,
            "filename": "eurostat-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dfd2b4fd6504c37abb20fe990c8fa6e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 16095,
            "upload_time": "2024-06-13T15:26:12",
            "upload_time_iso_8601": "2024-06-13T15:26:12.116029Z",
            "url": "https://files.pythonhosted.org/packages/51/a0/51b4254341558a69002100e1bc9df436c000e03a1ae3488b7e431c61b890/eurostat-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8f05ef71bc8983335f509170f28a3e4c5ef5a6cbe4c42232e341383746f0ccf",
                "md5": "962cac6940fbb8171386a23536b99ce3",
                "sha256": "6b70c5278084f603d6e92f481c1893f8ccc96f80d09347a822873a7ee679d54d"
            },
            "downloads": -1,
            "filename": "eurostat-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "962cac6940fbb8171386a23536b99ce3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 22591,
            "upload_time": "2024-06-13T15:26:14",
            "upload_time_iso_8601": "2024-06-13T15:26:14.018465Z",
            "url": "https://files.pythonhosted.org/packages/c8/f0/5ef71bc8983335f509170f28a3e4c5ef5a6cbe4c42232e341383746f0ccf/eurostat-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-13 15:26:14",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "noemicazzaniga",
    "bitbucket_project": "eurostat",
    "lcname": "eurostat"
}
        
Elapsed time: 4.65545s