Skip to main content

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 an Ivt. It accepts a path, IVT bytes, a bytearray, an object with __bytes__, or a binary file object.
  • to_arrow() returns rows in file order with unsigned member codes and a nullable float64 column named value.
  • 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.

  • None includes all rows and columns. {} includes all rows with only value.
  • Listed axes filter rows and appear as columns. Omitted axes keep all their members. An empty code list gives zero rows.

Member lookup tables

  • code contains 1-based native ordinals in file order. label_en and label_fr are nullable strings. Time-axis labels use ISO dates.
  • Native attributes use Arrow strings, integers, floats, or date32 dates. Text codes retain leading zeros. Native fields that collide with lookup column names, such as Code, receive a native_ prefix. Remaining name collisions receive numeric suffixes.
  • Both the fact table and lookup schemas carry pyivt.table_id and pyivt.selection_id for 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, and notes use LocalizedText.
  • Table fields include product_id, universe, number_of_datapoints, version, signature, descriptor_path, and read_only.
  • Time fields are frequency, start_date, and end_date. Frequency is "monthly", "quarterly", "semi_annual", or "annual".
  • Both LocalizedText and LocalizedLabels accept en and fr. Missing translations are None.

Dimensions and legends

  • ivt.layout returns a Layout with slugs, counts, n_dim, geo_dim, straddle, and window_count.
  • Each Dimension in meta.dimensions has name, description, notes, items, members, and ordinal. Its type is a DimensionType of "geographic", "normal", or "time_series".
  • meta.geographies returns Geographies with member_id, geo_label, geo_name, geo_uid, dqf_code, and tnr_short_form.
  • Each Footnote in meta.footnotes has symbol, number, description, scope, dimension, and member_id.
  • Each MissingValue in meta.missing_values has symbol, description, and code.

License

MIT

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)

Source distribution for pyivt 0.0.7
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)

Table of built distributions (wheels) for pyivt 0.0.7
File Actions
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 log

Release 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 log

Release 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 log

Release 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 log

Release 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 log

Release 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 log

Security 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.

Select from 6 files

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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page