Tutorial
Your first dataset
In this tutorial we will install imibare, load Rwanda’s monthly CPI data, and produce a simple chart in about five minutes. No prior knowledge of the project is required.
What we will build
By the end of this tutorial we will have a working Python script that:
- Loads Rwanda’s Consumer Price Index from 2009 to the present
- Prints a summary of the data
- Plots the overall CPI trend over time
Before we start
You need:
- Python 3.11 or later
pip(comes with Python)matplotlib(we will install it below)
Step 1: install imibare
pip install imibare matplotlibYou should see output ending with:
Successfully installed imibare-...For Iceberg time travel (loading a specific past version of a dataset), install the optional extra: pip install imibare[iceberg]
Step 2: load the CPI dataset
Open a Python file (or an interactive session) and type:
import imibare as imi
df = imi.load("rw.nisr.cpi.monthly")print(df.head())Run it. You should see something like:
date category value0 2009-01-01 overall 83.41 2009-01-01 food 92.12 2009-01-01 housing 79.33 2009-01-01 transport 77.84 2009-02-01 overall 84.1imi.load() downloaded the Parquet file from Cloudflare R2 and cached it at ~/.imibare/cache/. The next call is instant.
Step 3: inspect the data
print(df.dtypes)print(df.shape)print(df["category"].unique())You should see:
date datetime64[ns]category objectvalue float64dtype: object
(3640, 3)
['overall' 'food' 'housing' 'transport' ...]Notice that date is already a proper datetime column. imibare handles type conversion for you.
Step 4: plot the overall CPI trend
import matplotlib.pyplot as plt
overall = df[df["category"] == "overall"].sort_values("date")
plt.figure(figsize=(12, 4))plt.plot(overall["date"], overall["value"], color="#c8602a", linewidth=1.5)plt.title("Rwanda CPI, overall index (base year 2014=100)")plt.xlabel("Date")plt.ylabel("Index value")plt.tight_layout()plt.savefig("rw_cpi.png", dpi=150)plt.show()You should see a line chart saved to rw_cpi.png. Notice the base year switch in early 2015: the index resets to 100 because NISR changed the base year from 2009 to 2014.
Step 5: browse all available datasets
datasets = imi.catalog(country="RW")for d in datasets: print(f"{d.id:45s} {d.name}")You should see:
rw.nisr.cpi.monthly Consumer Price Index (monthly)rw.nisr.gdp.annual GDP by expenditure approach (annual)rw.bnr.fx.daily Official exchange rates (daily)rw.minecofin.budget-execution.quarterly Budget execution by ministry (quarterly)rw.rssb.contributions.annual RSSB contributions & member counts (annual)What we built
We installed the package, loaded a live dataset, inspected its structure, and produced a chart in five steps. The data came directly from Rwanda’s National Institute of Statistics, processed and published by the imibare pipeline.
What’s next
- Load a different dataset: try
imi.load("rw.bnr.fx.daily")for daily exchange rates - Filter by date range:
imi.load("rw.nisr.cpi.monthly", start="2020-01", end="2023-12") - Load as a Polars DataFrame:
imi.load("rw.nisr.cpi.monthly", engine="polars") - Load a specific past version (requires
imibare[iceberg]):imi.load("rw.nisr.cpi.monthly", version="2025-06-01") - See the full
imi.load()API in the Python package reference - Query data directly with DuckDB: How to query with DuckDB
You can also skip the Python package entirely and query the same data straight from R2 with DuckDB’s Iceberg integration:
import duckdb
duckdb.sql(""" ATTACH 'https://catalog.cloudflarestorage.com/imibare-data' AS imi (TYPE ICEBERG, READ_ONLY)""")duckdb.sql("SHOW TABLES").show()See How to query with DuckDB for the full setup, including credentials.