DEV Community

Your Evenings Data
Your Evenings Data

Posted on

Canada Job Bank open data in Python: posted truck driver wages by province (NOC 73300), in a CSV

Article type: How-to guide (one task: posted hourly wages by province for one occupation, from the latest month of Canada Job Bank open data, in a CSV)

Prerequisites: Python 3.9 or later with requests (pip install requests). No API key or account: the dataset is on open.canada.ca under the Open Government Licence (Canada). About 50 MB of free disk and memory for one month's file. An Apify account only if you use the hosted version at the end.

Tested on: 17 November 2026, with the October 2026 file.

Canada's Job Bank publishes every month's job postings as open data, with the occupation code (NOC), the province and the posted pay, and a short Python script can turn one month into a table of posted wages by province. If you set pay for drivers, advise newcomers on where an occupation pays more, or just want a real number instead of a guess, the question is: what are employers posting for this job in each province right now? This guide answers it for transport truck drivers (NOC 2021 code 73300) and saves the table as a CSV.

All the data in this post comes from one dataset record:

GET https://open.canada.ca/data/api/action/package_show?id=ea639e28-c0fc-48bf-b5dd-b8899bd43072

That's the open.canada.ca (CKAN) record for "Job Postings Advertised on Canada's National Job Bank Website". Its resources list has one CSV per month in English and French, newest first, each with a download url. No key, no login.

How do I get posted wages by province from Canada Job Bank open data?

Save this as job_bank_wages.py and run python job_bank_wages.py (truck drivers), or pass another NOC 2021 code, for example python job_bank_wages.py 63200 for cooks:

import csv
import io
import statistics
import sys
import time
from collections import defaultdict
from urllib.robotparser import RobotFileParser

import requests

NOC = sys.argv[1] if len(sys.argv) > 1 else "73300"     # NOC 2021: 73300 = transport truck drivers
DATASET = "ea639e28-c0fc-48bf-b5dd-b8899bd43072"        # "Job Postings Advertised on Canada's National Job Bank Website"
UA = "canada-job-bank-wages-tutorial/1.0 (python-requests)"
SANE_HOURLY = (15, 100)                                  # outside this, an "hourly" figure is a typo (gotcha 4)

session = requests.Session()
session.headers["User-Agent"] = UA

# 1. robots.txt first. open.canada.ca allows the data API but asks for 20 seconds between requests.
robots = RobotFileParser("https://open.canada.ca/robots.txt")
robots.read()
api = f"https://open.canada.ca/data/api/action/package_show?id={DATASET}"
if not robots.can_fetch(UA, api):
    sys.exit("robots.txt disallows the data API")
delay = robots.crawl_delay(UA) or 0

# 2. Find the newest English monthly file in the dataset record.
pkg = session.get(api, timeout=60).json()["result"]
newest = next(r for r in pkg["resources"] if r.get("language") == ["en"] and r.get("format") == "CSV")
month = newest["name_translated"]["en"].split(" Job Postings")[0]
time.sleep(delay)

# 3. Download it (about 50 MB). Most months are UTF-16 and tab-separated; a few 2024 months are UTF-8 with commas.
raw = session.get(newest["url"], timeout=300)
raw.raise_for_status()
utf16 = raw.content[:2] in (b"\xff\xfe", b"\xfe\xff")
text = raw.content.decode("utf-16" if utf16 else "utf-8-sig")
postings = list(csv.DictReader(io.StringIO(text), delimiter="\t" if utf16 else ","))
mine = [p for p in postings if p["NOC21 Code"] == NOC]
print(f"{month}: {len(postings):,} postings in the file; {len(mine):,} for NOC {NOC} ({mine[0]['NOC21 Code Name']})")


def num(v):
    return float(v) if v not in ("", "NA") else None


# 4. Hourly pay only (other periods can't be compared), within a sane range, per province.
hourly = [p for p in mine if p["Salary Per"] == "Hour" and num(p["Salary Minimum"]) is not None]
sane = [p for p in hourly if SANE_HOURLY[0] <= num(p["Salary Minimum"]) <= SANE_HOURLY[1]]
print(f"  hourly pay {len(hourly):,}; other pay periods {len(mine) - len(hourly)}; "
      f"left out as typos (outside {SANE_HOURLY[0]}-{SANE_HOURLY[1]} an hour) {len(hourly) - len(sane)}")
by_prov = defaultdict(list)
for p in sane:
    by_prov[p["Province/Territory"]].append(p)

rows = []
for prov, ps in sorted(by_prov.items(), key=lambda kv: -len(kv[1])):
    lo = [num(p["Salary Minimum"]) for p in ps]
    hi = [num(p["Salary Maximum"]) or num(p["Salary Minimum"]) for p in ps]
    rows.append({
        "month": month, "noc": NOC, "province": prov, "postings": len(ps),
        "vacancies": sum(int(p["Vacancy Count"]) for p in ps if p["Vacancy Count"].isdigit()),
        "job_bank_share": round(sum(p["External Indicator"] == "0" for p in ps) / len(ps), 2),
        "median_min_hourly": statistics.median(lo), "median_max_hourly": statistics.median(hi),
        "lowest_min": min(lo), "highest_max": max(hi),
    })
out = f"job_bank_{NOC}_hourly_by_province_{month.replace(' ', '_').lower()}.csv"
with open(out, "w", newline="", encoding="utf-8") as f:
    w = csv.DictWriter(f, fieldnames=list(rows[0]))
    w.writeheader()
    w.writerows(rows)
print(f"wrote {len(rows)} provinces to {out}\n")
print(f"{'province':<26}{'postings':>9}{'median min':>12}{'median max':>12}")
for r in rows:
    print(f"{r['province']:<26}{r['postings']:>9}{r['median_min_hourly']:>12.2f}{r['median_max_hourly']:>12.2f}")
Enter fullscreen mode Exit fullscreen mode

Output on 17 November 2026 (it took about 28 seconds, 20 of them the polite wait between the two requests):

October 2026: 59,130 postings in the file; 1,423 for NOC 73300 (Transport truck drivers)
  hourly pay 1,285; other pay periods 138; left out as typos (outside 15-100 an hour) 2
wrote 13 provinces to job_bank_73300_hourly_by_province_october_2026.csv

province                   postings  median min  median max
Ontario                         478       25.00       35.00
Québec                          230       26.59       30.00
British Columbia                190       36.30       36.87
Alberta                         181       36.00       37.50
Manitoba                         80       31.35       31.35
Saskatchewan                     49       31.72       34.65
Nova Scotia                      31       25.00       30.00
New Brunswick                    24       24.00       31.24
Newfoundland and Labrador         9       24.00       29.24
Prince Edward Island              6       24.00       26.75
Northwest Territories             2       27.50       35.00
Yukon                             2       35.00       44.50
Nunavut                           1       30.00       36.00
Enter fullscreen mode Exit fullscreen mode

Pay is in Canadian dollars an hour, as posted. The CSV also has vacancies, the share of postings made on Job Bank itself, and the lowest and highest figure per province. Before you quote the Ontario line, read gotcha 5.

Why it's built this way:

  • robots.txt first, and its crawl delay. open.canada.ca allows the data API but sets Crawl-delay: 20, so the script waits 20 seconds between the record and the download. That's most of the run time.
  • Find the file from the record, not from its name. The file names don't follow one pattern (...-en-oct2026.csv, ...-en-sept2026.csv, ...-en-december2025.csv, ...-postings-aug2024.csv, june-2024-...-en.csv), so building the URL from the month breaks. The record lists them newest first with a language tag.
  • Medians of the posted minimum and maximum, kept apart. Just over half the hourly postings (688 of 1,285) give one figure, so minimum and maximum are equal. The rest give a range, sometimes a wide one, and averaging the two ends would hide that.
  • Hourly only. 138 postings gave pay per year, month, week, day or two weeks. Converting them needs hours, which many postings don't give (gotcha 2), so the script leaves them out and says how many.

What should I check before I trust the table?

  1. It isn't a plain CSV. The October file starts with the bytes FF FE: it's UTF-16, tab-separated, and decoding it as UTF-8 fails at position 0. Older months differ: September 2026, October 2025 and March 2024 are UTF-16 with tabs, but August and June 2024 are UTF-8 with commas and start with a different first column (Job Title instead of WIC Job Location Snapshot ID). Check the header before reusing the script on an old month.
  2. Most postings come from other job boards, with fewer details. 749 of the 1,423 truck-driver postings (53%), and 63% of the whole file, have External Indicator 1: shared to Job Bank from other job boards. None of those 749 had hours, education or experience filled in; all 674 postings made on Job Bank had them. Almost all postings had a pay figure either way.
  3. Mixed pay periods. 1,285 truck-driver postings pay by the hour, 81 by the year, 32 by the month, 12 by the week, 8 by the day, 3 every two weeks and 2 gave no period. Never put them in one column.
  4. Some "hourly" figures are typos. Two postings marked hourly said 113,000 to 125,000 and 1,500 to 2,500, which are yearly and probably weekly figures. One such row can move a small province's median, so the script drops hourly figures outside 15 to 100 and prints how many.
  5. One repeated range can move a median. 268 truck-driver postings, all from other job boards, gave exactly 18 to 35 an hour, across 72 cities and 22 posting days; 206 of them were in Ontario. With them, Ontario's median minimum is 25.00 and maximum 35.00 (478 postings). Without them it's 36.00 and 36.10 (272 postings), and postings made on Job Bank alone give 37.00 and 37.00 (189). For a fair comparison, check the most common ranges in each province, or compare Job Bank postings only.
  6. A posting can be for several jobs. The 1,423 postings advertise 3,493 vacancies; 518 are for more than one, up to 40. The table counts postings; weight by Vacancy Count if you mean jobs.
  7. Near-duplicates. 107 truck-driver rows repeat the same job title, city, pay text and posting day as another row. They may be separate jobs, but if you count postings, decide whether to keep them.
  8. Spelling. The province is written Québec, with the accent, in all 15,292 rows; Quebec matches none. Dates are yyyy/mm/dd and the October file covers 1 to 31 October.

To change the task, pass another NOC 2021 code (63200 cooks, 31301 registered nurses), or change "Hour" to "Year" and the sane range to suit salaried jobs.

The hosted version (Disclosure: we built this)

We built an Apify Actor, Canada Job Bank Data API, that reads the same monthly files from the same open.canada.ca record. It filters by month (latest, latest-3 or YYYY-MM, up to 12 months a run), NOC 2021 code or prefix, province (name or code, accents ignored, so QC and Quebec both work), city, employment type, who posted it (postedVia) and minimum pay for a chosen pay period, and every month comes out in one row shape whatever its encoding or columns. It waits 20 seconds between requests to open.canada.ca. Status rows saying nothing matched, or that the source failed, are free. Monitor mode returns each new month once.

What it doesn't do: it returns postings, not the wage table, so the medians are still yours to compute; it passes pay through as posted, typos included (both rows from gotcha 4 came back as hourly); it reads the English files only; and the data has no employer names. It's pay per event; prices on the Actor's Pricing tab. For example (not run on the Apify platform for this post; a free local run of the Actor's code with this input on 15 November returned 1,285 postings):

{
  "months": ["latest"],
  "nocCodes": ["73300"],
  "salaryPer": "Hour",
  "maxResults": 2000
}
Enter fullscreen mode Exit fullscreen mode

Canada Job Bank Data API on Apify

Data: Job Postings Advertised on Canada's National Job Bank Website (Employment and Social Development Canada), October 2026 file, read 17 November 2026. Contains information licensed under the Open Government Licence (Canada). This post and the Actor are not affiliated with or endorsed by Employment and Social Development Canada, Job Bank or the Government of Canada.

Your Evenings

Top comments (0)