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 dimension in ivt.metadata.dimensions:
    print(dimension.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.members().items():
    pq.write_table(lookup, f"data.{slug}.parquet")

Each lookup has one row per member code. Join the fact table's dimension column to the lookup's code column to attach labels or other attributes.

Select a subset

slug = ivt.metadata.dimensions[0].slug
code = ivt.members()[slug]["code"][0].as_py()
selection = {slug: [code]}
subset = ivt.to_arrow(**selection)
subset_members = ivt.members(**selection)

Pass the same dimension keywords to both methods so their code types and subsets match. An integer fixes a dimension at one member and drops its column. A list retains the column and filters its rows. Omitted dimensions retain all members and their columns. An empty list selects zero rows.

Generate Python types for a table

pyivt codegen data.ivt --output dimensions.py

The generated module contains one IntEnum per dimension and a Dimensions typed dictionary for selection keywords. Use enum members as codes when calling to_arrow() or members(). Add --language fr to use French labels for enum names.

API Reference

Opening and exporting

  • 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.
  • members() returns a dictionary of PyArrow tables keyed by dimension slug, without decoding cells.
  • pyivt.__version__ gives the package version.

Member lookup tables

  • code contains native integer codes in file order. Axes without a native Code field use one-based positions. Invalid or duplicate native codes raise ValueError.
  • label is a nullable string in English by default. Use members(language="fr") for French labels. Time-axis labels use ISO dates.
  • Native attributes use Arrow strings, integers, floats, or date32 dates. Text fields retain their original values. 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 to identify the source table.

Metadata

meta = ivt.metadata
print(meta.title.en, meta.title["fr"])
print([(dimension.slug, dimension.items) for dimension in meta.dimensions])

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, and read_only.
  • Time fields are frequency, start_date, and end_date. Known frequencies are "monthly", "quarterly", "semi_annual", and "annual".
  • Both LocalizedText and LocalizedLabels accept en and fr. Missing translations are None.

Dimensions and legends

  • Each Dimension in meta.dimensions has slug, name, description, notes, items, and members. Its type is "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, and description.
  • Each MissingValue in meta.missing_values has symbol, description, and code.

License

MIT

Acknowledgments

Metadata

Release files for pyivt 0.0.8

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.8
File Size Uploaded Provenance Actions
pyivt-0.0.8.tar.gz 646.3 kB With provenance Details for pyivt-0.0.8.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pyivt 0.0.8
File Actions
pyivt-0.0.8-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pyivt-0.0.8-cp310-abi3-win_amd64.whl
pyivt-0.0.8-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for pyivt-0.0.8-cp310-abi3-manylinux_2_28_x86_64.whl
pyivt-0.0.8-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for pyivt-0.0.8-cp310-abi3-manylinux_2_28_aarch64.whl
pyivt-0.0.8-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pyivt-0.0.8-cp310-abi3-macosx_11_0_arm64.whl
pyivt-0.0.8-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for pyivt-0.0.8-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 10.7 MB

Release files / pyivt-0.0.8.tar.gz

Download URL pyivt-0.0.8.tar.gz
Size 646.3 kB
Tags Source
SHA-256 checksum
How to use checksums
31ff5bc503ec93bef7a558d8ca57c762a94180d3c4cbee46046ddf8ba05359aa
BLAKE2b-256 checksum
How to use checksums
ed2cbf9b56245a586e053ecdfb56a2da26f66c2ff444f0103a9d4962b67fa1ec
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 5, 2026.

Transparency log

Release files / pyivt-0.0.8-cp310-abi3-win_amd64.whl

Download URL pyivt-0.0.8-cp310-abi3-win_amd64.whl
Size 1.8 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6f28606b028f53bd9e3d430ffa48fe246c8b15ecf5189109ba9b5d406047e4f8
BLAKE2b-256 checksum
How to use checksums
491e14721b8d974b58013a0e0eaed835c43b5d2ad578217a808eed7f03c35eaf
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 5, 2026.

Transparency log

Release files / pyivt-0.0.8-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL pyivt-0.0.8-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
d891ca89b710b7072a746eee0d647f6c1d7560bcbb7efaa61eb3ef1de8165885
BLAKE2b-256 checksum
How to use checksums
ea4d4fc5d3fb757b1ca36003f0cba9ddcb6ab55044c60d0495c6bee8b4811552
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 5, 2026.

Transparency log

Release files / pyivt-0.0.8-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL pyivt-0.0.8-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
9eb79031ac073551b8c8a1faf94e7d3f3bd407eeb39aaa26afc962e997415fd1
BLAKE2b-256 checksum
How to use checksums
f2200f330454164b1886340a7f5d7aebe3c1da87c67a00639fdca8fe61d1f7a3
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 5, 2026.

Transparency log

Release files / pyivt-0.0.8-cp310-abi3-macosx_11_0_arm64.whl

Download URL pyivt-0.0.8-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
d2efffb766b0af3fe1f9b534a9f96267dd946a8dfefee804c334109b21019f04
BLAKE2b-256 checksum
How to use checksums
2a3f958bd8cb6b70fab7e778b426408d53a4fcb278734ceff4673c7c63f22756
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 5, 2026.

Transparency log

Release files / pyivt-0.0.8-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pyivt-0.0.8-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
428c1984a36b1a125ae73ac07e0d641dc2d2b699cf81c8020eba4e43e4c5054d
BLAKE2b-256 checksum
How to use checksums
d65fb81fc642f6db0b6cbf8c43e038454465ff586be034e82cdbb7561405dd26
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 5, 2026.

Transparency log

Security for pyivt 0.0.8

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.8.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 5, 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