Skip to main content

Python wrapper around Open Data from the Czech Statistical Office

Project description

czso

Python wrapper around Open Data from the Czech Statistical Office (CZSO).

The real credit goes to CZSO for publishing hundreds of machine-readable datasets with proper metadata and codelists.

Inspired by the R package by Petr Bouchal: petrbouchal/czso

Open In Colab

Installation

pip install czso

Or with uv:

uv add czso

Quick start

📓 See demo.ipynb for an interactive walkthrough — browse the catalogue, download datasets, plot wages over time, and explore codelists.

import czso

# Browse available datasets
catalogue = czso.get_catalogue()
print(catalogue[["dataset_id", "title"]].head())

# Download a dataset as a DataFrame
df = czso.get_table("110079")

# Get dataset with metadata
df, meta = czso.get_table("110079", include_metadata=True)
print(meta["title"])

# Get raw (uncleaned) data
df_raw = czso.get_table("110079", clean=False)

# Retrieve a codelist (číselník)
codelist = czso.get_codelist(100)

API

Function Description
get_catalogue() Full catalogue of available CZSO open datasets
get_table(dataset_id, ...) Download and read a dataset as a DataFrame
get_dataset_metadata(dataset_id) JSON-LD metadata for a dataset
get_table_schema(dataset_id) JSON table schema for a dataset resource
get_codelist(codelist_id) Retrieve a CZSO codelist (číselník)

get_table options

  • resource_num — which resource to download (default 0)
  • force_redownload — skip cache and re-download
  • dest_dir — directory for caching downloaded files
  • clean — drop code columns, rename to friendly names (default True)
  • include_metadata — return (DataFrame, metadata_dict) tuple

AI coding skill

This repo includes a skill that teaches AI coding agents how to use the czso package. Install it with:

npx skills add https://github.com/Marigold/czso --skill czso-data

Related projects

  • mcp-csu — MCP server for the CZSO DataStat API. Gives AI assistants (Claude, etc.) direct access to 700+ statistical datasets. Run with uvx mcp-csu.
  • petrbouchal/czso — R package for CZSO open data (the inspiration for this project).

Development

make .venv          # install all deps (including dev: ruff, ty, pytest)
make format         # auto-format with ruff
make lint           # lint + fix with ruff
make check-typing   # typecheck with ty
make test           # format + lint + typecheck + unit tests

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

czso-0.1.0.tar.gz (90.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

czso-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file czso-0.1.0.tar.gz.

File metadata

  • Download URL: czso-0.1.0.tar.gz
  • Upload date:
  • Size: 90.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for czso-0.1.0.tar.gz
Algorithm Hash digest
SHA256 668a4a89c6529cf7dda8615aecad08e3c7539730c34e3a25b48f1b3360750af1
MD5 7997e1813d26000c510417ee4f91de10
BLAKE2b-256 f192135e0613d8a3dd06c3f4524c73eed9ee6effd0584f48de0fb93065e2f740

See more details on using hashes here.

Provenance

The following attestation bundles were made for czso-0.1.0.tar.gz:

Publisher: publish.yml on Marigold/czso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file czso-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: czso-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for czso-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b115036f9a0ed930a8302143bf2a5e2220af38bcf242def1d66a0fdd0b617f
MD5 43b6ec8fa67ce461dacfa5a3cd94a57c
BLAKE2b-256 821941f0f08b26d38e9175183602d9eda8cbe6ed78d7c6e41470e69c5319d621

See more details on using hashes here.

Provenance

The following attestation bundles were made for czso-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Marigold/czso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page