← Blog · 2026-06-17

OCR and CPI in one script

worked-example inflation rbnz oecd python

I often want inflation and the Official Cash Rate on the same chart. CPI (via OECD’s NZ series on eolas) is quarterly. The OCR is monthly from RBNZ. Different agencies, different cadences — usually a morning of portal hopping.

With eolas it’s a few lines:

import pandas as pd
from eolas_data import Client

client = Client("your_api_key")

cpi = client.get("nz_cpi")  # annual % change, quarterly
ocr = client.get("rbnz_b2_wholesale_rates_monthly")

cpi["date"] = pd.to_datetime(cpi["date"])
ocr["date"] = pd.to_datetime(ocr["date"])

# Forward-fill OCR onto CPI dates for a simple overlay
merged = (
    cpi.merge(
        ocr[["date", "cash_rate_official_cash_rate_ocr"]],
        on="date",
        how="left",
    )
    .sort_values("date")
)

print(merged.tail())
# merged.plot(x="date", y=["value", "cash_rate_official_cash_rate_ocr"])  # if your CPI column is `value`

A few practical notes from actually running this:

  • Column names are stable but source-shaped. RBNZ’s OCR lands as something like cash_rate_official_cash_rate_ocr — long, but consistent across pulls. Check df.columns once.
  • Frequencies don’t magically align. Forward-fill is a choice for a chart, not gospel for a paper. Use the frequency that matches your question.
  • OECD vs bulk. OECD series on eolas are fine for analysis via the API; they are not for bulk redistribution the way CC-BY NZ tables are. Headers and dataset metadata carry the licence — read them if you’re shipping a product.

I’m not going to oversell the macro story from a five-line join. The point is narrower: two official series, one client, no re-scraping when someone redesigns a spreadsheet.

If you want the wider catalogue: browse datasets. Free API key: signup.

Try it free

Get an API key in seconds — 10 requests per month on the Free plan, no credit card.

Get your free API key →