---
name: statcan-monthly-railway-carloadings-ingestion
description: "How to get Statistics Canada railway carloadings data into a pandas DataFrame and Parquet: access, the request, the format, limits, quirks and terms."
---

# Load Statistics Canada rail carloadings into Parquet

Source entry: https://signal-lab-jet.vercel.app/datasets/statcan-monthly-railway-carloadings
Provider: https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=2310021601
Checked against the provider's documentation: 2026-11-01

## Access
- No account or key. The Web Data Service returns the current full-table ZIP URL.
- The ZIP contains the data CSV and a separate metadata CSV.

## Request
```bash
curl 'https://www150.statcan.gc.ca/t1/wds/rest/getFullTableDownloadCSV/23100216/en'
```

## Format
ZIP containing CSV data and metadata. Data columns include REF_DATE, GEO, DGUID, Railway carloading components, Estimates, UOM, VECTOR, VALUE and quality/status fields.

## Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
```python
"""Statistics Canada railway carloadings table -> pandas -> Parquet. No key."""
import io
import zipfile
import requests
import pandas as pd

API = "https://www150.statcan.gc.ca/t1/wds/rest/getFullTableDownloadCSV/23100216/en"
r = requests.get(API, timeout=60)
r.raise_for_status()
download_url = r.json()["object"]
z = requests.get(download_url, timeout=120)
z.raise_for_status()
with zipfile.ZipFile(io.BytesIO(z.content)) as archive:
    with archive.open("23100216.csv") as source:
        df = pd.read_csv(source, low_memory=False)
df["REF_DATE"] = pd.to_datetime(df["REF_DATE"], format="%Y-%m")
df.to_parquet("statcan_monthly_railway_carloadings.parquet", index=False)
print(len(df), "rows", df["REF_DATE"].min().date(), "to", df["REF_DATE"].max().date(),
      df["GEO"].nunique(), "geographies")
```
Run by us on 2026-11-01 (python 3.13.5 | pandas 3.1.0 | pyarrow 26.0.0 | requests 2.34.2). Result: 146412 rows 1999-01-01 to 2026-08-01 3 geographies

## Limits
- Rate limit: Not stated.
- The full-table ZIP was about 21 MB uncompressed for the data CSV at verification.
- The latest checked reference period was August 2026.

## Quirks
- The WDS endpoint returns a JSON object containing a second URL; fetch that URL to obtain the ZIP.
- The archive's CSV filenames omit the -eng suffix used in the download URL.
- Use STATUS, SYMBOL and TERMINATED fields when interpreting missing, revised or ended series.

## Terms and attribution
- The Statistics Canada Open Licence allows commercial and non-commercial sharing and redistribution.
- Statistics Canada must be cited whenever its data are used.
- Terms page: https://www.statcan.gc.ca/en/terms-conditions/open-licence-faq

## Sources
- https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=2310021601: "Monthly railway industry carloading statistics for intermodal and non-intermodal traffic in metric tonnes, for the period from January to the most current month of the current year, Canada, Eastern Division and Western Division."
- https://www.statcan.gc.ca/en/developers/wds/user-guide: "For users who require the full table/cube of extracted time series, a static file download is available in both CSV and SDMX (XML) formats."
- https://www.statcan.gc.ca/en/terms-conditions/open-licence-faq: "This licence allows you to use Statistics Canada information without restrictions on sharing and redistribution, for commercial and non-commercial purposes."
- https://www.statcan.gc.ca/en/terms-conditions/open-licence-faq: "Statistics Canada must be cited whenever data are used."

## Help improve this skill
Missing a source, or see something to improve? Call the MCP tool suggest_source or feedback (or POST /api/suggest or /api/feedback). Reviewed ideas: https://signal-lab-jet.vercel.app/agent-suggestions

Information for educational purposes only. Free tiers, limits and licenses belong to the providers and may change; check the provider's own terms before using the data.
