What a naive load gets wrong: traps in Canadian well files

November 2026Illustrative, not for reserves or investment decisions

Most of the work in oil and gas data is cleaning, not analysis. We counted what goes wrong when you open the Alberta, Saskatchewan and BC regulator files with a default spreadsheet or pandas.read_csv, and what the Tidywells loaders do about each one. These are counts from the files we downloaded in November 2026.

1. Codes lose their leading zeros

Many identifier and code columns are made only of digits with leading zeros. Spreadsheets and default CSV readers turn them into numbers and drop the zeros, which breaks matches and makes different codes look equal.

Alberta Well Infrastructure (681,275 rows), values that lose leading zeros:

Saskatchewan Well Infrastructure (159,645 rows):

BC production file, 2025 onward (188,501 rows):

Tidywells reads every column as text and pads licence numbers to seven characters.

2. Repeated rows

0%5%10%15%20%duplicate well rowsblank well statuslicence rows repeatedmissing spud dateshare of file rowsAlbertaSaskatchewan
Figure 1. Share of file rows affected by each problem, Alberta and Saskatchewan. Real counts from the downloaded files.
ProblemAlbertaSaskatchewan
Rows in the Well Infrastructure file681,275159,645
Distinct wells667,540158,165
Extra rows for the same well13,7351,480
Licence rows repeated for the same licence2,3360
Wells with a blank status121,9825,766
Wells with no spud date5,0552
Spellings of licence status (raw, cleaned)16 → 82 → 2

If you count rows as wells, Alberta is off by 13,735. Tidywells keeps one row per well, the one with the latest status date.

3. Status and licence spelling

Alberta's licence status appears in 16 spellings that reduce to 8 real values after trimming and case-folding. Counting by raw text splits one status into several. A blank well status (121,982 Alberta wells, 18% of rows) is also common, and as the inventory post shows, some of those wells are producing.

4. Same word, different thing

5. The good news

Linking works when you handle the zeros: 99.99% of Alberta well rows and 100% of Saskatchewan well rows matched a licence record, so the two-file join from well ID to licensee is reliable.

What this means in practice

Limits

Reproduce it

Code: github.com/Jay-Kimani/TidyWells, posts/cache_matrix.py, posts/wells_study.py, posts/dq_study.py and posts/gen_posts2.py. Download the files yourself from Petrinex and the BC Energy Regulator; we do not host the data.

Illustrative only. Not for reserves reporting or investment decisions.

Contains information licensed from Petrinex public data (Alberta, Saskatchewan) and the BC Energy Regulator; Crown copyright of the provinces is acknowledged. Tidywells is not affiliated with any regulator.

Want the data behind these posts?Tidywells Pro: tidy monthly CSVs and companion tables. CAD $4.99 a month, 3-day free trial.
See Pro