SDK quickstart
Ask the DFO a question from Python or TypeScript, check its interpretation, get the dataset, and fetch that exact version again later.
The Python and TypeScript clients for the Development Finance Observatory (DFO) call the DFO APIs from code. Use them to build analyses, pipelines, and applications.
You don't need an API key to get started. Guides and changelogs for both are in the SDK repository.
Install
development-finance imports as dfo and needs Python 3.12 or later. The pandas extra adds to_pandas().
uv add "development-finance[pandas]" # in a uv project
pip install "development-finance[pandas]" # with pipAsk a question
Search interprets your question and returns its interpretation: the indicator, the places, the years, the unit, and the source. This step does not return rows, so you can check the interpretation before you download any.
import dfo
answer = dfo.search("ODA from Germany to Nigeria")
print(answer)Germany's net disbursements (bilateral flows) to Nigeria for official development assistance, 1960 to 2024. Current US dollars · OECD DAC2a.
Fetch: answer.fetch()Check the interpretation before you fetch the data. Here, search interpreted "ODA" as net bilateral disbursements in current US dollars. To get a different interpretation, reword the question, for example "gross ODA disbursements from Germany to Nigeria in constant prices". When a question has several interpretations, the answer lists them, numbered from 0. Call answer.choose(0) (await answer.choose(0) in TypeScript) to get a new answer for the first interpretation.
Fetch and save the dataset
answer.fetch() builds the dataset on the DFO's servers and downloads it.
data = answer.fetch()
print(data)
df = data.to_pandas()
print(df.iloc[:, :4].tail(3))
data.save("german-oda.parquet")<Dataset Germany's net disbursements (bilateral flows) to Nigeria for official development assistance, 1960 to 2024. Current US dollars · OECD DAC2a.
Source: OECD DAC2A
Version: cv_b8706e8a1459d68a2b78114986e03b83 (exact), held until 16 December 2026, not pinned
Rows: 65, time_period as integer years
Keep: data.save(path) · newest later: dfo.fetch(data.ref, latest=True)>
time_period financingProvider_label financingRecipient_label value
62 2022 Germany Nigeria 106367247.0
63 2023 Germany Nigeria 118463280.0
64 2024 Germany Nigeria 75121452.0data.save() writes the rows, the citation, and the version reference to one Parquet file.
Your output will differ. The DFO imports new releases of a source, so the content_version, the years, and the numbers change over time. The cv_ id is the content_version. It identifies these exact rows.
Check whether the data changed
data.ref identifies the exact version you fetched. Pass it to fetch() with latest set and compare the returned reference with the saved one. The two references are equal while the DFO serves the same rows.
import dfo
old = dfo.load("german-oda.parquet")
new = dfo.fetch(old.ref, latest=True)
if new.ref != old.ref:
print("The DFO's data has changed since you saved it")
new.save("german-oda.parquet")dfo.fetch(old.ref) without latest returns the saved version's rows again, until the date printed after held until on the dataset.
Next
- Get a free API key in Keys and limits. A script without a key gets 20 API calls a minute for its IP address, and a key gives your account 600.
- Read the Python and TypeScript SDK guides for multiple interpretations, narrowing a fetch, computing a number on the DFO, cards and shares, and pipelines.
- Call the API directly from any other language.
- Read Updates and revisions for how long the DFO keeps a version and what a pinned version is.