stats-can
Read StatsCan data into python, mostly pandas dataframes
What it is and what it does
stats-can is a Python client for Statistics Canada's Web Data Service (WDS), wrapping the official API to make it easier to fetch Canadian statistical data directly into pandas DataFrames. It implements most WDS functions and adds convenience helpers for common workflows like loading tables by ID or retrieving vectors of time-series data. The library depends on requests for HTTP calls, pandas and numpy for data handling, tqdm for progress feedback, and pydantic for validation.
The package is aimed at data analysts, researchers, and developers working with Canadian statistics who want to programmatically access StatCan data without manual downloads. It handles the API plumbing and data transformation, letting you focus on analysis rather than HTTP mechanics.
Use it for:
- Download Canadian census or demographic tables into a DataFrame for analysis or visualization
- Retrieve time-series economic indicators (e.g., employment, inflation) from StatCan vectors
- Automate regular data pulls from Statistics Canada for reporting or dashboards
- Combine multiple StatCan tables in a single Python script for cross-dataset analysis
- Build data pipelines that ingest official Canadian statistics into a data warehouse
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Fetches Statistics Canada data through the Web Data Service API and loads it into pandas DataFrames, implementing most WDS functions with helper methods for common table and vector queries.
Yes, if you work with Canadian statistical data and want programmatic access without manual downloads. The package is actively maintained, has low install friction, and covers most WDS use cases. The GPL-3.0-or-later license is a consideration only if you're building proprietary software; for research, analysis, or open-source projects it poses no barrier. No known security vulnerabilities.
Install
stats-can on PyPI
pip
pip install stats-canuv
uv add stats-canpoetry
poetry add stats-canInstalling stats-can
Before you install
Low install friction with a pure-Python wheel and five common dependencies (requests, tqdm, pandas, numpy, pydantic). Actively maintained as of 2026-04-14 with regular commits.
License in practice
GPL-3.0-or-later (copyleft): any derivative work or distribution must also be open-source under compatible terms. Suitable for internal or open-source projects but incompatible with proprietary closed-source applications.
Quickstart
pip install stats-can
import stats_can
df = stats_can.table_to_df('table_id')
# or
df = stats_can.vector_to_df(['vector_id'])
Requires Python 3.10 or later (supports current versions, <4.0). Statistics Canada Table/Vector IDs must be obtained from the StatCan data page.
Verify before relying
- Whether all WDS endpoints are fully implemented or if some remain unsupported
- Performance characteristics when fetching large tables or many vectors
- Rate limiting or throttling behavior from the Statistics Canada API
Package facts
| License | GPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — requests, tqdm, pandas, numpy, pydantic |
| Maintenance | actively maintained — 122 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 129,495/month — #11,667 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: stats_can-3.2.3-py3-none-any.whl
Keywords: statistics, Canada, data, API
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
env_canadaProvides async access to Environment Canada…
permissive · top 15,000 on PyPI
pypostalcodeLooks up Canadian postal codes to retrieve…
permissive · top 15,000 on PyPI
pandasqlpandasql lets you query pandas DataFrames using…
unclear · top 5,000 on PyPI
rasterstatsRasterstats computes summary statistics (mean,…
permissive · top 15,000 on PyPI
facets-overviewGenerates summary statistics for dataset…
permissive · top 15,000 on PyPI
eurostatFetches statistical data and metadata from…
permissive · top 15,000 on PyPI
wbdataWbdata provides a Python interface to query and…
copyleft · top 5,000 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
stockstatsAdds technical analysis indicators and…
permissive · top 15,000 on PyPI
delta-sharingDelta Sharing is a Python client library for…
permissive · top 5,000 on PyPI