skillfed

stats-can

Read StatsCan data into python, mostly pandas dataframes

stats-can v3.2.3 129.5K downloads/30d#11,667 on PyPI77
Copyleft license GPL-3.0-or-later Active released

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-can

uv

uv add stats-can

poetry

poetry add stats-can

Installing 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

statistics canada api clientstatcan data to pandascanadian statistical data downloadweb data service pythonstatcan table vector lookupcanadian census data api
canadian-datastatistics-apidata-integration

More Information Analysis packages