Turn an NGX Daily List Into a Clean Dataset Without Turning Dashes Into Zero

NGX PDF Python missing values need a column contract before a replacement rule. Preserve an empty price as missing, keep a real zero as zero and retain an unlabelled marker in its own field. A dash does not become a numeric price just because it sits near one.

This exercise uses five hand-checked rows from page 17 of the supplied NGX Daily Official List. We ran small Python conversion and null-versus-zero checks locally. We did not build or test a full-PDF extractor. The result is a modest dataset a learner can explain, rather than an investment screen or stock recommendation.

Inspect the NGX PDF before splitting text

The NGX PDF labelled 12/03/2026 places Official Open, Official Close, Current Market Price and Business Done Price in different columns. Page 17 contains wrapped security names and a narrow unlabelled marker column beside Current Market Price. Plain-text extraction can flatten those boundaries and make adjacent values look like one field.

SymbolCurrent Market Price (₦)Business Done Price (₦)Business Done QtyRaw marker
JAPAULGOLD3.503.608,500−
ARADEL1,340.001,206.002blank
OANDO48.0548.0510−
CONOIL204.40200.0019blank
ETERNA42.3042.3035−
Hand transcription of selected fields on page 17. Official Open and Official Close are blank in all five selected rows. The marker’s meaning is not inferred.

OANDO’s 48.05 appears in two named price fields, while ARADEL’s current market price and business-done price differ. A parser that takes the first number after the ticker would not respect those headings. Keep each source field separate and compare the cleaned row with the page before using it.

Preserve missing values in the NGX Python dataset

Across five selected page-17 rows, Official Open and Official Close each have five blank cells; Current Market Price and Business Done Price each have five numeric values.
This availability chart describes 20 selected price cells. It does not rank securities, measure returns or interpret the separate unlabelled dash marker.

The sample contains ten blank cells across the four price fields. Converting them to zero would invent ten price observations. It would also make a later minimum or average answer a different question. Missingness is information about what this source cell supplies, not evidence that the underlying economic value is zero.

CSV has no built-in null type. In the clean download, an empty field represents a missing value under our dictionary. State that rule when reading the CSV into another tool. Do not silently fill every empty field with zero, and do not let a plotting library draw missing values as zero-height observations without a deliberate decision.

A dash rule belongs to a verified numeric column

Our numeric helper treats a blank or dash token as missing only after we identify the field as numeric and confirm that treatment fits. In this sample, the visible dashes sit in a separate unlabelled column. We preserve them as raw markers. We do not claim they are missing prices or assign them a market-direction meaning.

A synthetic “0” test checks the other side of the rule. Zero must survive as Decimal(0), while an empty numeric token remains None. The supplied raw sample has no zero-valued observations in its four price fields. The zero test is a deliberate artificial fixture, not another NGX row.

Do not guess the date from an ambiguous token

The business-done date token is 12/03/26 in these rows. By itself, that can parse as 12 March or 3 December under different conventions. The clean sample therefore leaves business_date_iso empty and marks the convention for verification. The source label is retained verbatim; we do not certify an ISO date from the filename alone.

An explicit parser is useful only after you establish the field’s convention. The example below demonstrates both interpretations so the ambiguity cannot disappear unnoticed. Once you confirm the source contract, adopt that specific format and retain the raw token for audit. Do not mix a document’s print date with a transaction-date column.

Run the NGX PDF Python missing values checks

from decimal import Decimal
from datetime import datetime

def numeric_cell(raw):
    token = raw.strip()
    if token in {"", "-"}:  # only a verified numeric column
        return None
    return Decimal(token.replace(",", ""))

assert numeric_cell("") is None
assert numeric_cell("-") is None
assert numeric_cell("0") == Decimal("0")
assert numeric_cell("1,340.00") == Decimal("1340.00")

raw_date = "12/03/26"
# These illustrate ambiguity; neither convention is adopted.
assert datetime.strptime(raw_date, "%d/%m/%y").date().isoformat() == "2026-03-12"
assert datetime.strptime(raw_date, "%m/%d/%y").date().isoformat() == "2026-12-03"
# Keep business_date_iso missing until the source convention is verified.

The retained local run passed these cell-level assertions. It also checked that the five transcribed rows contain ten missing and ten present price cells. That verifies our small fixture and treatment rules; it does not measure extraction accuracy across the 27-page document. A new page layout needs a fresh header and row review.

Cell-treatment map separates blank numeric prices, a dash in the unlabelled marker column and an ambiguous date token. Each keeps a different preservation or verification rule.
Nigeria Coding Academy’s editorial cleaning contract is grounded in the inspected page. It is not an official NGX data dictionary.

Make the portfolio artifact easy to audit

Keep the original PDF, the page number, raw rows, clean rows and a short field dictionary together. Review wrapped names and repeated headers before considering automated extraction. Add assertions for a known row and a known missing cell, then inspect the actual output rather than assuming an error-free script means a correct table.

For another dataset exercise, use our GDP quarter-key validation guide. Both projects start with the same discipline: decide what a field means before calculating or charting it. Here the price fields, marker and date status remain distinct throughout.

Download the raw rows and cleaning tools

Method and limitations

Checked on 5 December 2026. We visually inspected page 17, hand-transcribed five rows, retained the source PDF and ran local cell-conversion assertions. The date convention remains unresolved in this teaching dataset. We did not extract the whole PDF, verify live prices, analyse investments or recommend trades.