Statistics Canada
Import Canadian national or provincial supply-use and input-output tables.
Choose geography and detail level. The retrieval workflow requires source access unless the necessary files are already cached.
Import#
import mario
db = mario.parse_statcan(year=2022, table="SUT", level="summary", geo="Canada")
Result · A MARIO database. Inspect db, db.get_index("all")
and db.units before selecting quantities for your analysis.
Inputs and options#
Relevant source pages
Official StatCan SUT catalogue: Supply and use tables
Official StatCan IOT catalogue: Symmetric input-output tables
StatCan WDS documentation: WDS user guide
MARIO can query the official WDS API directly, so there is no need to download the raw .csv bundles manually unless you want a local cache.
Key arguments
The key public arguments are:
year: reference year to parse;table: choose"SUT"or"IOT";level: choosesummary,detail, orlink1997when supported;geo: geography label such asCanadaor one province/territory;valuation: only forIOT, usuallybasicorpurchaser;path: optional directory for locally cached raw files;download: whenTrue, MARIO downloads the raw WDS bundle intopathand then parses it locally.
`SUT` versus `IOT`
Use table="SUT" when you want the native split structure with S, U, Yc, Ya, Va, and Vc.
Use table="IOT" when you want the symmetric input-output representation with Z, Y, and V.
For SUT, level="link1997" is also available. For IOT, valuation= matters because the tables are exposed at both basic and purchaser prices.
Direct online parsing versus local cache
Use direct online parsing when you just want the database and do not need the raw files afterwards.
Use download=True together with path=... when you want MARIO to keep the raw WDS .csv bundle locally. This is the most useful option when you parse the same StatCan table repeatedly or want a reproducible local cache.
Cache layout and supported values
path is optional and acts as a local WDS cache:
StatCan/
└── cache/
├── 36-10-0438-01_*.csv
└── 36-10-0001-01_*.csv
Supported levels:
SUT:summary,detail,link1997;IOT:summary,detail.
For IOT, valuation can be basic or purchaser.
import mario
Parse a Canada `SUT` directly from WDS
This is the simplest StatCan workflow.
db = mario.parse_statcan(
year=2022,
table="SUT",
level="summary",
geo="Canada",
)
db
Parse a provincial `SUT`
The SUT tables expose provinces and territories as separate geographies. The parser expects the published StatCan geography label.
db = mario.parse_statcan(
year=2022,
table="SUT",
level="detail",
geo="Ontario",
)
db
Parse an `IOT` at basic prices
For IOT, pass valuation="basic" or valuation="purchaser".
db = mario.parse_statcan(
year=2022,
table="IOT",
level="detail",
valuation="basic",
)
db
Parse an `IOT` at purchaser prices
The public API stays the same; only the valuation selector changes.
db = mario.parse_statcan(
year=2022,
table="IOT",
level="summary",
valuation="purchaser",
)
db
Keep the raw WDS files locally
When download=True, MARIO stores the downloaded raw .csv bundle inside path and then parses the local file. This is useful when you want to avoid re-downloading the same table.
db = mario.parse_statcan(
year=2022,
table="SUT",
level="detail",
geo="Quebec",
path="/path/to/StatCan",
download=True,
)
db
Caveats
the parser is API-driven, so network availability matters more than for local-file parsers;
download=Trueis optional, not required;this walkthrough focuses on the economic StatCan tables only;
environmental extensions are intentionally left out here.
Continue with Inspect and query a database or Calculate matrices.