Use the data files (any language)
Not using Python, JavaScript or Go? Every dataset is a plain CSV file (UTF-8, comma-separated, one header row), so you can load it into any language, a spreadsheet or a database. Or call the REST API from any language that can make an HTTP request.
Download
Section titled “Download”Pin a release tag (here v1.0.0) so your copy never changes under you:
curl -O https://raw.githubusercontent.com/asgatcreation/naija-data/v1.0.0/data/states.csvcurl -O https://raw.githubusercontent.com/asgatcreation/naija-data/v1.0.0/data/lgas.csvThe same files over a CDN: https://cdn.jsdelivr.net/gh/asgatcreation/naija-data@v1.0.0/data/lgas.csv.
You can also browse them on GitHub.
Directorydata/
- states.csv 37 rows: 36 states + FCT
- lgas.csv 774 rows: LGAs and FCT area councils
- wards.csv 8,809 rows: INEC registration areas
- senatorial_districts.csv 109 rows
- federal_constituencies.csv 360 rows
- state_constituencies.csv 990 rows
- banks.csv 899 rows: CBN-licensed institutions
- phone_prefixes.csv mobile prefixes and their networks
- phone_area_codes.csv 56 landline area codes
- phone_number_blocks.csv 305 allocated number blocks
- plate_categories.csv plate colours by category
- sources.json where every value came from
How the files fit together
Section titled “How the files fit together”lgas.state_code→states.code(e.g.LA)wards.lga_code→lgas.code(e.g.NG025011)wards.senatorial_district,federal_constituency,state_constituency→ thecodeof the matching filesources(in every file) → theidinsources.json
Column guide
Section titled “Column guide”| Column | Meaning |
|---|---|
code |
The stable identifier to store. States: ISO 3166-2 without NG- (LA). LGAs: UN P-code (NG025011). Wards: INEC code (24-11-01). Electoral units: SD/FC/SC + INEC’s number. |
inec_code |
INEC’s own code (states 24, LGAs 24-11, constituencies FC/236/LA) |
pcode |
UN OCHA P-code, used by humanitarian datasets |
name |
Official display name |
slug |
URL-friendly name (akwa-ibom) |
aliases |
Other spellings and names, separated by | (Yenegoa, AMAC, Abuja) |
lat, lon |
Approximate centre point (decimal degrees) |
unverified_fields |
Columns confirmed by only one source, separated by | |
sources |
Source ids, separated by | |
Empty cells mean “not known”. Lists inside a cell are separated by |.
Example: MySQL / PostgreSQL
Section titled “Example: MySQL / PostgreSQL”CREATE TABLE states (code CHAR(2) PRIMARY KEY, name VARCHAR(40) NOT NULL);CREATE TABLE lgas (code CHAR(8) PRIMARY KEY, state_code CHAR(2) NOT NULL REFERENCES states(code), name VARCHAR(60) NOT NULL);-- then import the matching columns from states.csv and lgas.csvSELECT name FROM lgas WHERE state_code = 'LA' ORDER BY name;Example: PHP
Section titled “Example: PHP”$rows = array_map('str_getcsv', file('lgas.csv'));$header = array_shift($rows);$lgas = array_map(fn($r) => array_combine($header, $r), $rows);$lagos = array_filter($lgas, fn($l) => $l['state_code'] === 'LA');Example: Flutter / Dart (with the API)
Section titled “Example: Flutter / Dart (with the API)”final res = await http.get(Uri.parse('https://naija-data-api.asgatcreation.workers.dev/v1/states/LA/lgas'));final lgas = (jsonDecode(res.body)['data'] as List).map((l) => l['name']).toList();Credit (required)
Section titled “Credit (required)”The data is free to use, including commercially, under CC BY 4.0. You only need to give credit, for example on your about or credits page:
Nigerian reference data from naija-data by Akanji Oluwaseun Gabriel (https://github.com/asgatcreation/naija-data), licensed CC BY 4.0.