ilostat¶
Python tools for accessing and working with ILOSTAT data
ilostat provides direct access to ILOSTAT data as pandas DataFrames, with filtering, multilingual labels, metadata, caching, dictionaries, and SDMX-style access.
Installation¶
Install the latest release from PyPI:
python -m pip install ilostat
Quick start¶
Retrieve an ILOSTAT dataset directly as a pandas DataFrame:
import ilostat
df = ilostat.get_df(
"UNE_TUNE_SEX_AGE_NB_A",
filters={
"ref_area": "FRA",
},
)
print(df.head())
SDMX access¶
ilostat also provides an SDMX-oriented interface:
df = ilostat.get_sdmx(
"UNE_TUNE_SEX_AGE_NB_A",
filters={
"REF_AREA": "FRA",
"SEX": "SEX_F",
},
)
Dataset structures, codelists, and dataflows can be accessed using SDMX conventions.
Structure, codelist, and dataflow resources can also be serialized as SDMX-ML 3.1 and SDMX-JSON 2.1.
Main features¶
-
:material-database-search: Data access
Retrieve ILOSTAT datasets directly as pandas DataFrames with
get_df(). -
:material-filter: Filtering
Filter by reference area, sex, classification, source, time period, and other dataset dimensions.
-
:material-translate: Multilingual labels
Work with codes and labels in English, French, and Spanish.
-
:material-database-sync: Local cache
Downloaded data and metadata are cached locally and reused automatically.
-
:material-code-json: SDMX
Access data, structures, codelists, and dataflows using SDMX conventions.
-
:material-book-open-variant: Metadata
Retrieve tables of contents, dictionaries, dataset metadata, and dataset-specific dictionaries.
Codes and labels¶
By default, get_df() returns ILOSTAT codes.
Use type="both" to return codes together with their labels:
df = ilostat.get_df(
"UNE_TUNE_SEX_AGE_NB_A",
type="both",
lang="en",
)
Labels are available in English, French, and Spanish:
df = ilostat.get_df(
"UNE_TUNE_SEX_AGE_NB_A",
type="both",
lang="fr",
)
SDMX resources¶
The get_sdmx() function provides access to SDMX data and structural metadata from ILOSTAT.
Dataset structure¶
Retrieve the SDMX structure associated with a dataset:
structure = ilostat.get_sdmx(
"UNE_TUNE_SEX_AGE_NB_A",
resource="structure",
)
print(structure)
See the Structures documentation for more details.
Codelists¶
Access the classifications and codes associated with SDMX datasets.
See the Codelists documentation.
Dataflows¶
Discover the datasets available through the ILOSTAT SDMX interface.
See the Dataflows documentation.
Further documentation¶
-
:material-rocket-launch: Getting started
Installation and first steps.
-
:material-database: Bulk API
Retrieve ILOSTAT data, dictionaries and catalogues.
-
:material-network: SDMX API
Access SDMX data and structural metadata.
-
:material-harddisk: Cache management
Improve performance through local caching.
-
:material-code-braces: API reference
Explore the available Python functions and parameters.