Build a Nigerian GDP Chart Without Comparing the Wrong Quarters

A Nigeria GDP Python year-on-year chart needs quarter validation before it needs a polished colour scheme. Give every observation a year-quarter key, retain the growth measure and select each comparison explicitly. That prevents a correct subtraction from answering the wrong economic question.

This beginner project uses four published rates and a short Python script. We ran the CSV checks and arithmetic locally. We did not rebuild GDP from national accounts, test a full workbook importer or estimate a new growth rate. The output is a small, inspectable portfolio artifact with a clear boundary.

Start with four explicit year-quarter rows

The Finance Ministry statement dated 30 November 2026 reports real GDP growth of 4.99% year-on-year for Q3 2026, alongside 3.98% for Q3 2025. It also gives 3.89% for Q1 2026 and 4.43% for Q2 2026. We transcribed those four observations with their reference periods. The source date describes the statement, not the quarter each figure measures.

Year-quarter keyReal GDP year-on-year growth
2025-Q33.98%
2026-Q13.89%
2026-Q24.43%
2026-Q34.99%
Source: Federal Ministry of Finance, 30 November 2026. Selected observations include a gap between Q3 2025 and Q1 2026.
Nigeria real GDP year-on-year growth: Q3 2025 3.98%, Q1 2026 3.89%, Q2 2026 4.43%, Q3 2026 4.99%. These selected observations are not a consecutive-quarter series.
The bars retain the same annual growth measure. They do not show quarter-on-quarter GDP growth or the level of GDP.

Two differences answer two different questions

Subtracting 4.43 from 4.99 gives 0.56 percentage points. It compares the annual growth rate reported for Q3 2026 with the annual rate reported for Q2 2026. It does not divide Q3 output by Q2 output, so it is not quarter-on-quarter GDP growth.

Subtracting 3.98 from 4.99 gives 1.01 percentage points. Here the comparison is between annual growth rates for the same reference quarter in two years. Again, the result is a difference between rates. It is neither an extra 1.01% of GDP nor a calculation from the underlying output levels.

Keep “percentage points” in the result label. A percentage change in a growth rate would require a different calculation and a clear reason to use it. For this project, an explicit difference is enough. Adding more decimals or a dramatic headline would not improve the measure.

Validate quarter keys before drawing the chart

Three-part validation map: check the year-quarter row key, retain the real GDP annual growth measure, and select the intended comparison key before subtracting.
An editorial coding checklist links reference periods, units and comparison choices. The source statement supplies the rates; Nigeria Coding Academy supplies the validation plan.

A dictionary keyed by “2026-Q3” is safer than assuming the last two rows are the pair you need. A file may arrive in reverse order, contain a duplicate period or mix annual totals with quarterly observations. Check uniqueness and the expected key set first. Then choose the pair by its meaning.

The quarter field must be an integer from one to four. The key must match the year and quarter fields. Keep the rate in a field named real_gdp_yoy_percent rather than a vague “growth” column. A separate source-vintage field or source register helps a future reviewer distinguish revisions from coding errors.

Run the small Python example

Download the four-quarter CSV below and place it beside this script. It uses Python’s standard library and Decimal for the displayed decimal arithmetic. The assertions check this particular fixture; they are not a general validator for every NBS file. A failed assertion should stop this example before a chart is exported.

import csv
from decimal import Decimal

with open("nigeria-gdp-yoy-four-quarters.csv", newline="") as f:
    rows = list(csv.DictReader(f))
values = {}
for row in rows:
    year, quarter = int(row["year"]), int(row["quarter"])
    assert 1 <= quarter <= 4
    key = f"{year}-Q{quarter}"
    assert row["period_key"] == key
    assert key not in values, "Duplicate year-quarter key"
    values[key] = Decimal(row["real_gdp_yoy_percent"])
assert len(values) == 4
assert {"2025-Q3", "2026-Q1", "2026-Q2", "2026-Q3"} == set(values)
print(values["2026-Q3"] - values["2026-Q2"])  # 0.56 pp
print(values["2026-Q3"] - values["2025-Q3"])  # 1.01 pp

The retained local run prints 0.56 and 1.01. Those are percentage-point differences because the input column contains percentage rates. The code does not fetch a live series, infer missing quarters or silently turn an empty cell into zero. A later source update needs a new review of the expected values and keys.

Move from the tiny CSV to official materials carefully

The NBS GDP catalogue links the Q3 2026 report and other quarterly resources. Start there when extending the project. Inspect the actual file’s sheet names, table headings, units and revision notes before adding an importer. Do not assume its columns match this teaching CSV. We inspected the catalogue listing; this article does not claim a tested official-workbook extraction.

Keep an untouched source copy and compare a few imported rows with the published table. If an intended quarter is absent, report it as missing and stop that comparison. A chart joining selected observations must say that gaps exist. For another portfolio planning exercise, see our small AI work-sample guide.

Download the data and validation tools

Method and limitations

Checked on 5 December 2026. We transcribed four rates from the Ministry’s 30 November statement, inspected the NBS catalogue and ran the displayed Python checks and subtractions locally. Later revisions may change the observations. This is a coding and data-reading exercise, not a new national-accounts estimate or a claim about any learner’s employment prospects.