8.1.1.1. pandasdmx.reader package

8.1.1.1.1. Submodules

8.1.1.1.2. pandasdmx.reader.sdmxjson module

This module contains a reader for SDMXML v2.1.

class pandasdmx.reader.sdmxjson.Reader(request, dsd, **kwargs)

Bases: pandasdmx.reader.BaseReader

Read SDMXJSON 2.1 and expose it as instances from pandasdmx.model

dataset_attrib(sdmxobj)
dim_at_obs(sdmxobj)
generic_groups(sdmxobj)
generic_series(sdmxobj)
getitem0 = operator.itemgetter(0)
getitem_key = operator.itemgetter('_key')
group_key(sdmxobj)
header_error(sdmxobj)
initialize(source)
international_str(name, sdmxobj)

return DictLike of xml:lang attributes. If node has no attributes, assume that language is ‘en’.

iter_generic_obs(sdmxobj, with_value, with_attributes)
iter_generic_series_obs(sdmxobj, with_value, with_attributes, reverse_obs=False)
read_as_str(name, sdmxobj, first_only=True)
series_attrib(sdmxobj)
series_key(sdmxobj)
structured_by(sdmxobj)
write_source(filename)

Save source to file by calling write on the root element.

class pandasdmx.reader.sdmxjson.XPath(path)

Bases: object

8.1.1.1.3. pandasdmx.reader.sdmxml module

This module contains a reader for SDMXML v2.1.

class pandasdmx.reader.sdmxml.Reader(request, dsd, **kwargs)

Bases: pandasdmx.reader.BaseReader

Read SDMX-ML 2.1 and expose it as instances from pandasdmx.model

dataset_attrib(sdmxobj)
dim_at_obs(sdmxobj)
generic_groups(sdmxobj)
generic_series(sdmxobj)
group_key(sdmxobj)
header_error(sdmxobj)
initialize(source)
international_str(name, sdmxobj)

return DictLike of xml:lang attributes. If node has no attributes, assume that language is ‘en’.

iter_generic_obs(sdmxobj, with_value, with_attributes)
iter_generic_series_obs(sdmxobj, with_value, with_attributes, reverse_obs=False)
series_attrib(sdmxobj)
series_key(sdmxobj)
structured_by(sdmxobj)
write_source(filename)

Save XML source to file by calling write on the root element.

8.1.1.1.4. Module contents

This module contains the base class for readers.

class pandasdmx.reader.BaseReader(request, dsd, **kwargs)

Bases: object

initialize(source)
read_as_str(name, sdmxobj, first_only=True)
read_identifiables(cls, sdmxobj, offset=None)

If sdmxobj inherits from dict: update it with modelized elements. These must be instances of model.IdentifiableArtefact, i.e. have an ‘id’ attribute. This will be used as dict keys. If sdmxobj does not inherit from dict: return a new DictLike.

read_instance(cls, sdmxobj, offset=None, first_only=True)

If cls in _paths and matches, return an instance of cls with the first XML element, or, if first_only is False, a list of cls instances for all elements found, If no matches were found, return None.