Ask an AI assistant, with sources
Numbers you can defend
No guessed places. No hidden gaps.
Lesson 5 of 6 · Analyse it in Python
Try it yourself
- Python, after
import undata as unun.ask("child mortality in Bengal") # what the search box decided un.get("3.1.1", "Bengal") # undata refuses to guess - Python, after
import undata as untable = un.latest("undata/sdg/VC_IHR_PSRC", "Africa", within=10) un.coverage(table) print(un.cite(table)) - Open the search-box check in Colab
Remember: undata never guesses a place and never turns a gap into a zero. Its warnings name what is missing.
Transcript
- A wrong number in a UN report is worse than no number at all. undata is built to fail loudly, never quietly. Here are the safeguards, and what they look like.
- It never guesses which place you meant. Missing data is named, never shown as zero. Values from different years are flagged. And every table carries its citation.
- Ask data.un.org’s search box about child mortality in Bengal, and it answers about the United States, a place you never named. un.ask shows you what the search box decided, and flags the guess. un.get refuses to guess at all. Bengal is not a country, so it stops, says so, and tells you how to see every name it knows.
- Now ask for each African country’s latest homicide rate, from the last ten years. 23 places have no data at all. They are left out of the table and named in a warning, so a chart can never show them as zero. 12 more only have old figures, like Eritrea from 2012. They are set aside, and named too. And the values that remain still span 2016 to 2024, so undata says that a ranking across them is not like for like.
- un.coverage puts it in one line. 60 places asked for, 25 with a recent value, 12 too old, 23 with nothing. Put that line under your chart, and nobody mistakes twenty-five countries for a continent.
- And every table knows where it came from. The citation names the agency that measured the figure, the exact series, and the date you retrieved it.
- The place you meant. The gaps in plain sight. The years on the table. And the agency that measured it. That is a number you can defend.
- Install undata with pip, and find twelve worked examples on the documentation site. Next: the same safeguards, inside an A I assistant.