Open mephinet opened 1 year ago
Hi @dr-leo, adding some more references to this one, essentially the same error to a similar flow:
pdsdmx
librarypdsdmx.read_sdmx()
method with same output error: NotImplementedError: ('{urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ESTAT:HLTH_SILC_08(33.0):ObsLevelDim:TIME_PERIOD}DataSet', 'start')Code snippet below:
import io
import pandasdmx as pdsdmx
import requests
# pdsdmx requests objet (ESTAT)
Estat = pdsdmx.Request("ESTAT")
# ESTAT dataflow
d_flow = "hlth_silc_08".upper()
# ESTAT structure query (pdsdmx)
Dsd_estat = Estat.datastructure(d_flow)
# ESTAT data query
api_param = {
"startPeriod": "2022",
"endPeriod": "2022",
"format": "SDMX_2.1_STRUCTURED",
}
url_estat = f"https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/{d_flow}/.PC..NO_UNMET...BE+BG"
indicator_xml = requests.get(url_estat, api_param, timeout=15)
buffer_read = io.BufferedReader(io.BytesIO(indicator_xml.content))
try:
xml_message = pdsdmx.read_sdmx(
buffer_read, format="XML", dsd=Dsd_estat.structure[d_flow]
)
data_df = xml_message.to_pandas(dtype=str, attributes="o", rtype="rows")
print("OK")
except Exception as error:
print(error)
I recently upgraded to pandasdmx[cache]>=1.10.0 after the recent Eurostat API change. At the same time, I improved my code to follow the walkthrough document and use structure-specific data.
However, now I run into a NotImplementedError when accessing Eurostat.
The minimal reproducer is:
When I remove the dsd argument from the
data
call, the code runs without issues.