SDMX CSV
This format is only used for data, not for Structures. The SDMX CSV readers and writers are compatible with SDMX-CSV 1.0 and 2.0 standards on the Basic format.
Important
To use the SDMX-CSV functionalities, you need to install the pysdmx[data] extra.
Check the installation guide for more information.
Reading
Although the use of the general reader is always recommended, specific readers for SDMX-CSV are also available:
DATA_SDMX_CSV_1_0_0 -> pysdmx.io.csv.sdmx10.reader
- pysdmx.io.csv.sdmx10.reader.read(input_str)
Reads csv data and returns a sequence of Datasets.
- Parameters:
input_str (
str
) – str.- Return type:
Sequence
[PandasDataset
]- Returns:
A Sequence of Pandas Datasets.
- Raises:
Invalid – If it is an invalid CSV file.
DATA_SDMX_CSV_2_0_0 -> pysdmx.io.csv.sdmx20.reader
- pysdmx.io.csv.sdmx20.reader.read(input_str)
Reads csv data and returns a sequence of Datasets.
- Parameters:
input_str (
str
) – str.- Return type:
Sequence
[PandasDataset
]- Returns:
A Sequence of Pandas Datasets.
- Raises:
Invalid – If it is an invalid CSV file.
Writing
Although the use of the general writer is always recommended, specific readers for SDMX-CSV are also available:
DATA_SDMX_CSV_1_0_0 -> pysdmx.io.csv.sdmx10.writer
- pysdmx.io.csv.sdmx10.writer.write(datasets, output_path=None)
Write data to SDMX-CSV 1.0 format.
- Parameters:
datasets (
Sequence
[PandasDataset
]) – List of datasets to write. Must have the same components.output_path (
Union
[str
,Path
,None
]) – Path to write the data to. If None, the data is returned as a string.
- Return type:
Optional
[str
]- Returns:
SDMX CSV data as a string, if output_path is None.
DATA_SDMX_CSV_2_0_0 -> pysdmx.io.csv.sdmx20.writer
- pysdmx.io.csv.sdmx20.writer.write(datasets, output_path=None)
Write data to SDMX-CSV 2.0 format.
- Parameters:
datasets (
Sequence
[PandasDataset
]) – List of datasets to write. Must have the same components.output_path (
Union
[str
,Path
,None
]) – Path to write the data to. If None, the data is returned as a string.
- Return type:
Optional
[str
]- Returns:
SDMX CSV data as a string, if output_path is None.