In this unit, we'll go over how to install pysdmx and how to verify installation once complete.
You have two options for installing pysdmx. Let's look at each of them.
Select each option to learn more.
pip install pysdmx
pip install pysdmx[all]
NOTE: Depending on your environment, this command may generate an error. If that happens, it is probably because your command line environment is trying to interpret the square brackets. If this happens, placing quotes around pysdmx[all] should resolve the issue as in:
pip install "pysdmx[all]"
To verify if everything is working correctly, let's connect to the SDMX Global Registry and retrieve some ESTAT metadata.
Call the SDMX Global Registry and retrieve ESTAT categories using an asynchronous API call:
import os
from pysdmx.api.fmr import AsyncRegistryClient
# A simple pysdmx example to call a registry.
endpoint = "https://registry.sdmx.org/sdmx/v2" # SDMX global registry
client = AsyncRegistryClient(endpoint)
cs = await client.get_categories("ESTAT", "ESA2010TP")
Output:
NAMAIN_T0110_Q
NASU_1719PR_5
NAMAIN_T0101_Q
NASEC_T0621_A
NAMAIN_T0111_Q
NAMAIN_T0101_Q
…
# Let's see the list of dataflows - the ID and Name
for flow in cs.dataflows:
# os.mkdir(flow.id)
print(flow.id, " : ", flow.name)
Output:
NAMAIN_T0110_Q : NAMAIN_T0110_Q
NASU_1719PR_5 : NASU_1719PR_5
NAMAIN_T0101_Q : NAMAIN_T0101_Q
NASEC_T0621_A : NASEC_T0621_A
NAMAIN_T0111_Q : NAMAIN_T0111_Q
…
# Now, let's see the categories - both ID and DESCRIPTION
for category in cs.categories:
print("\n", category.name, " : ", category.description)
Output:
Main aggregates : Table 1 — Main aggregates — quarterly and annual exercise
Table 3 — Tables by industry
Table 5 — Household final consumption expenditure
Table 20 — Cross classification of fixed assets by industry and by asset (stocks)
Table 22 — Cross classification of gross fixed capital formation (GFCF) by industry and by asset (transactions)
…
| There are additional references identified in Unit 6 and they may be consulted as needed throughout this course. In addition, there are two cheat sheets specified at the end of this course – One with all of the synchronous API calls and a second with the asynchronous calls. |
Now that you've completed our introduction and some information on getting started with pysdmx, try this question. Which of the following statements are true?
Select your answer and then select Submit.
Only statement 2 is true. All other statements are false. Pysdmx can be used to automate process tasks. However, pysdmx focuses on simplicity, providing a subset of the SDMX functionalities without requiring advanced knowledge of SDMX. Also, sometimes installing pysdmx with all of the extras (not core functionality) results in errors because your command line environment is trying to interpret the square brackets in the code. Using quotations in the code (in the correct location, as described earlier) will help.
The correct answer is option 2.
Only statement 2 is true. All other statements are false. Pysdmx can be used to automate process tasks. However, pysdmx focuses on simplicity, providing a subset of the SDMX functionalities without requiring advanced knowledge of SDMX. Also, sometimes installing pysdmx with all of the extras (not core functionality) results in errors because your command line environment is trying to interpret the square brackets in the code. Using quotations in the code (in the correct location, as described earlier) will help.
In this next unit, you'll learn about reading and writing SDMX datasets using pysdmx.
Need help finding something? I am an AI Assistant that's here to help!
What are you looking for?
By using this AI-powered service ("Service"), you acknowledge and agree to the following:
This Service uses generative AI to assist with statistical analysis and research. While the Service strives to deliver useful information, the output ("Output") may contain inaccuracies, omissions, or biases. The Output is provided for informational purposes only and should not be considered professional advice. You remain responsible for how you interpret and use the Output.
The BIS makes no warranties regarding the accuracy or completeness of the Output and accepts no liability for any loss or damage resulting from its use.
Do not include or share personal, private, confidential or proprietary information when using the Service.
By using this technology, you agree to the Terms and Conditions.
Ask and get clear explanations about SDMX standards.
Find tools and documentation on website quickly.
Ask about API, software and libraries supporting SDMX.
Locate technical guides, specifications, and FAQs.