pyivt
Read Statistics Canada Beyond 20/20 (.ivt) tables in Python: bilingual
metadata, and export to Apache Arrow.
Install
pip install pyivt
pyivt needs Python 3.11 or later and PyArrow 14 or later. There are wheels for Linux (x86_64 and aarch64, glibc or musl), Windows (x64) and macOS (x86_64 and arm64). See supported platforms for details.
Open a table
The examples use the 2021 Census table 98-10-0001:
curl -O https://www150.statcan.gc.ca/n1/en/tbl/b2020/98100001.zip
import pyivt
ivt = pyivt.open("98100001.zip")
print(ivt.metadata.title.en)
print(ivt.metadata.title.fr)
Population and dwelling counts: Canada, provinces and territories
Chiffres de population et des logements : Canada, provinces et territoires
open() takes an .ivt file or a ZIP that contains one, as a path, bytes or a
binary file object.
Inspect dimensions
for dimension in ivt.metadata.dimensions:
print(dimension.slug, dimension.items, dimension.members.en[:2])
geography 14 ['Canada', 'Newfoundland and Labrador']
population_and_dwelling_counts_11 11 ['Population, 2021', 'Population, 2016']
Slugs name the columns in exports and the keys in selections.
Export
import pyarrow.parquet as pq
table = ivt.to_arrow()
members = ivt.to_member_table()
print(table.num_rows, table.column_names)
pq.write_table(table, "98100001.parquet")
pq.write_table(members, "98100001.members.parquet")
154 ['geography', 'population_and_dwelling_counts_11', 'value']
to_arrow() has one row per cell. Dimension columns hold 1-based member
positions, and a null value is a missing cell. to_member_table() has the
label and native attributes of each member. Use to_member_table(language="fr")
for French labels.
For a table too large to build at once, stream it:
with ivt.iter_batches() as reader:
with pq.ParquetWriter("98100001.parquet", reader.schema) as writer:
for batch in reader:
writer.write_batch(batch)
Select a subset
An integer fixes a dimension at one member and drops its column. A list keeps the column and limits it to those members.
selection = {"geography": [1, 2, 3], "population_and_dwelling_counts_11": 1}
population = ivt.to_arrow(select=selection)
members = ivt.to_member_table(select=selection)
labels = dict(zip(members["code"].to_pylist(), members["label"].to_pylist()))
for row in population.to_pylist():
print(labels[row["geography"]], row["value"])
Canada 36991981.0
Newfoundland and Labrador 510550.0
Prince Edward Island 154331.0
To select by name instead of number, generate a Python module of enums with
pyivt codegen 98100001.zip --output dimensions.py.
Errors
A file that cannot be read raises a subclass of pyivt.IvtError, which is a
ValueError:
CorruptFileError: the file is damaged or is not an IVT file.UnsupportedFormatError: the file is an IVT, but pyivt cannot read its layout. Container versions 2 and 4 are supported.ResourceLimitError: a memory estimate exceeds a safety limit. Useselectoriter_batches(), or raisemax_memory_bytes.
try:
pyivt.open(b"not an IVT file")
except pyivt.CorruptFileError as error:
print(f"{error.file_len} bytes is too short for an IVT file")
15 bytes is too short for an IVT file
The API reference covers every public name.
License
Metadata
Release files for pyivt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyivt-0.1.0.tar.gz | 1.1 MB | With provenance | Details for pyivt-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 13.6 MB
Release files / pyivt-0.1.0.tar.gz
| Download URL | pyivt-0.1.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac0a179f84a94b9a5a4950f376aca3c5d3a83110ad85401caa3c65e356fb2954
|
|
BLAKE2b-256 checksum How to use checksums |
d9588fcdc7f8ceaad9d8e53bc7d332c98e543e8f20c10e44ba8f7ea3122463af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-win_amd64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
56bc8bcfc991bea31082dd6908d1fbc6e2c432ff5c2cb7cd7e595993dc69ee4f
|
|
BLAKE2b-256 checksum How to use checksums |
36691983b6ed42c1004eb591bdc40e823e67ac04e74e66e865ce1ff9b1617825
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a052387c256283346b95b69dc9c43dff08d6ab282391aeb56e351b93679f3754
|
|
BLAKE2b-256 checksum How to use checksums |
62ae1e09df803bea6e9a5cb6d94cd215e7ae8d12020d4117f22dc6fa7cc66079
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c99198f9f852fac5ee1144ecb17c1d4b36d8723efd2c7ae80bbe74ce8a6b32e1
|
|
BLAKE2b-256 checksum How to use checksums |
cba755e6180df9432eee4baec1c1469062a7093fe1be63a8cc072550ebe1114b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4bccb1feb6842ec08b06983f3215e2492ca8d39e0fe20f509de8b2a59f7aba70
|
|
BLAKE2b-256 checksum How to use checksums |
518e927be4fe5c9dcaf7211c30785e9701cd2bfaed9df363e38a7a0a4231e4bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
657e63c668d961d002b4d573493a678bfde49ddc07859669ba7b87c529087e27
|
|
BLAKE2b-256 checksum How to use checksums |
934da2ce5015a50c3651bc31ef247992c4d76202bb5c388b2ca70204a1e02bcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3f1eb1718247c6bbe7e2c50468e83b49079682bf3ce62feb53487edcd8e58ec2
|
|
BLAKE2b-256 checksum How to use checksums |
5ece22a891d7804b4f8875f3a30355effa0020da205c7ed8d1b412bdd8ed6bd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / pyivt-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | pyivt-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
d26f3c5c22a169d511520c2f22d6a4e44baf3262070dff2b0521bfd7377da13a
|
|
BLAKE2b-256 checksum How to use checksums |
e08cacc2879b509d9be2322edd351f89660770a97c491fa52fe60af797235e83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for pyivt 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for pyivt-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.