pyivt
About the Project
Read Statistics Canada Beyond 20/20 (.ivt) files, inspect bilingual metadata, and export to Apache Arrow or Parquet.
Getting Started
Prerequisites
Python 3.10+ and PyArrow 14+. Installation brings in PyArrow automatically.
Installation
pip install pyivt
With uv, run uv add pyivt.
Usage
Open a table
import pyivt
ivt = pyivt.open("data.ivt")
print(ivt.metadata.title.en or ivt.metadata.title.fr)
Use an extracted IVT version 4 file. For a download, pass the complete IVT bytes to pyivt.open().
Inspect dimensions
for slug, dimension in zip(ivt.layout.slugs, ivt.metadata.dimensions):
print(slug, dimension.name.en, dimension.items)
Use the slugs as Arrow column names and selection keys.
Export to Parquet
import pyarrow.parquet as pq
table = ivt.to_arrow()
pq.write_table(table, "data.parquet")
for slug, lookup in ivt.to_member_tables().items():
pq.write_table(lookup, f"data.{slug}.parquet")
Each lookup has one row per native member code. Join the fact table's
dimension column to the lookup's code column and select the attributes you need.
Select a subset
selection = pyivt.Selection({ivt.layout.slugs[0]: [1]})
subset = ivt.to_arrow(selection)
subset_members = ivt.to_member_tables(selection)
Pass the same selection to both methods so their code types and subsets match.
Embed member tables in a single file
from base64 import b64decode
import pyarrow as pa
import pyarrow.parquet as pq
pq.write_table(ivt.to_arrow(embed_members=True), "data.parquet")
slug = ivt.layout.slugs[0]
key = f"pyivt.members.v1.{slug}".encode()
metadata = pq.read_schema("data.parquet").metadata
with pa.ipc.open_file(b64decode(metadata[key])) as reader:
lookup = reader.read_all()
Embedding leaves the fact columns unchanged. The lookup tables are stored as base64-encoded Arrow IPC files in schema metadata. Use separate Parquet lookups if your tools rewrite files without preserving custom metadata.
API Reference
Opening and exporting
ivt = pyivt.open("data.ivt")
table = ivt.to_arrow()
members = ivt.to_member_tables()
open()returns anIvt. It accepts a path, IVT bytes, abytearray, an object with__bytes__, or a binary file object.to_arrow()returns rows in file order with unsigned member codes and a nullablefloat64column namedvalue.to_member_tables()returns a dictionary of PyArrow tables keyed by dimension slug, without decoding cells.to_arrow(embed_members=True)attaches the corresponding lookup tables as schema metadata.ivt.__arrow_c_stream__()returns an Arrow stream capsule.pyivt.__version__gives the package version.
Selections
selection.validate(ivt)
pyivt.Selection.from_dict(selection.to_dict())
pyivt.Selection.from_json(selection.to_json())
Both exports accept a Selection or a mapping from dimension slugs to 1-based codes. selection_id identifies the selection.
Noneincludes all rows and columns.{}includes all rows with onlyvalue.- Listed axes filter rows and appear as columns. Omitted axes keep all their members. An empty code list gives zero rows.
Member lookup tables
codecontains 1-based native ordinals in file order.label_enandlabel_frare nullable strings. Time-axis labels use ISO dates.- Native attributes use Arrow strings, integers, floats, or
date32dates. Text codes retain leading zeros. Native fields that collide with lookup column names, such asCode, receive anative_prefix. Remaining name collisions receive numeric suffixes. - Both the fact table and lookup schemas carry
pyivt.table_idandpyivt.selection_idfor matching exports.
Metadata and layout
meta = ivt.metadata
print(meta.title.en, meta.title["fr"])
print(ivt.layout.slugs, ivt.layout.counts)
Read-only IvtMetadata is available without decoding cells.
title,author,category,keywords, andnotesuseLocalizedText.- Table fields include
product_id,universe,number_of_datapoints,version,signature,descriptor_path, andread_only. - Time fields are
frequency,start_date, andend_date.Frequencyis"monthly","quarterly","semi_annual", or"annual". - Both
LocalizedTextandLocalizedLabelsacceptenandfr. Missing translations areNone.
Dimensions and legends
ivt.layoutreturns aLayoutwithslugs,counts,n_dim,geo_dim,straddle, andwindow_count.- Each
Dimensioninmeta.dimensionshasname,description,notes,items,members, andordinal. Itstypeis aDimensionTypeof"geographic","normal", or"time_series". meta.geographiesreturnsGeographieswithmember_id,geo_label,geo_name,geo_uid,dqf_code, andtnr_short_form.- Each
Footnoteinmeta.footnoteshassymbol,number,description,scope,dimension, andmember_id. - Each
MissingValueinmeta.missing_valueshassymbol,description, andcode.
License
Acknowledgments
Metadata
Release files for pyivt 0.0.7
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.0.7.tar.gz | 644.7 kB | With provenance | Details for pyivt-0.0.7.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pyivt-0.0.7-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for pyivt-0.0.7-cp310-abi3-win_amd64.whl |
| pyivt-0.0.7-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details for pyivt-0.0.7-cp310-abi3-manylinux_2_28_x86_64.whl |
| pyivt-0.0.7-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details for pyivt-0.0.7-cp310-abi3-manylinux_2_28_aarch64.whl |
| pyivt-0.0.7-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for pyivt-0.0.7-cp310-abi3-macosx_11_0_arm64.whl |
| pyivt-0.0.7-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for pyivt-0.0.7-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 10.7 MB
Release files / pyivt-0.0.7.tar.gz
| Download URL | pyivt-0.0.7.tar.gz |
|---|---|
| Size | 644.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f20225fb846d9eadef5651a2747d743ab2b06c07cf799e02b5118939a067bc97
|
|
BLAKE2b-256 checksum How to use checksums |
c35662a47589b6fa3f99e5551fecd808fef0bd4a7b21642ea81196b6a71df063
|
| 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 4, 2026.
Transparency logRelease files / pyivt-0.0.7-cp310-abi3-win_amd64.whl
| Download URL | pyivt-0.0.7-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d66cddff383f8fbd35bf0f684595445658f2f8f40691b7d7ab9306f3da9a8b3c
|
|
BLAKE2b-256 checksum How to use checksums |
c01204411b8ecff76b6ffc66dcf59a364a7fd084e90836ef2df89c87d68874e0
|
| 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 4, 2026.
Transparency logRelease files / pyivt-0.0.7-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | pyivt-0.0.7-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
53fdc2fa05abdd4759a5190dd4da5be5a822c8f340333af52ad8a4cc8c71d0cd
|
|
BLAKE2b-256 checksum How to use checksums |
538be2b4c48584aae38879f52101974910d2874ca2a31f31e4757e3af2a719f1
|
| 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 4, 2026.
Transparency logRelease files / pyivt-0.0.7-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | pyivt-0.0.7-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
2a3c7fd38edf914bbc82d99d497fb7072d44c2434d43b44315251da7d7888bb8
|
|
BLAKE2b-256 checksum How to use checksums |
3de737a93c4a17278ddc31b5177a0677ea1176cae64ae876dd1ef55c4552a7a6
|
| 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 4, 2026.
Transparency logRelease files / pyivt-0.0.7-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | pyivt-0.0.7-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1cab127bc4ea4c8ac39d7c0b27e2843b05ab765f53d8dcd7781c23e43db8596a
|
|
BLAKE2b-256 checksum How to use checksums |
5599fdde99961a032fda5d5657349a972e3a4d2f74f8efc1cfd2a064beff5dc2
|
| 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 4, 2026.
Transparency logRelease files / pyivt-0.0.7-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | pyivt-0.0.7-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
040caf8c30cf5abf65d8f8eae715af368da8f9524f2ac353a1023dd28dfa506a
|
|
BLAKE2b-256 checksum How to use checksums |
9b63a0c14c3cd0ba4ddaa8afab4d30621007d58fd7634cc85318380bb9e5121b
|
| 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 4, 2026.
Transparency logSecurity for pyivt 0.0.7
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 6 files in this release have been uploaded with provenance metadata.
Attestation for pyivt-0.0.7.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 4, 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.