cbspy
A modern Python client for CBS Statline open data that returns Polars DataFrames with human-readable column names.
- Github repository: https://github.com/thomaspinder/cbspy/
- Documentation: https://thomaspinder.github.io/cbspy/
Installation
pip install cbspy
Quick Start
import cbspy
client = cbspy.Client()
# Discover available tables
tables = client.list_tables(language="en")
print(tables.head())
# shape: (5, 7)
# id, title, description, period, frequency, record_count, modified
# Inspect a table's structure
meta = client.get_metadata("37296eng")
for col in meta.properties:
print(f"{col.id}: {col.display_name} ({col.unit})")
# Fetch data with human-readable column names
df = client.get_data("37296eng")
print(df.head())
# Columns like "Total population", "Males", "Females" instead of
# "TotalPopulation_1", "Males_2", "Females_3"
# Filter by time period
df = client.get_data("37296eng", periods=["2022JJ00", "2023JJ00"])
Development
make install # Create venv and install pre-commit hooks
make test # Run tests with coverage
make check # Run linting and type checking
Repository initiated with fpgmaas/cookiecutter-uv.
Release files for cbspy 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cbspy-0.0.4.tar.gz | 148.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cbspy-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 156.3 kB
Release files / cbspy-0.0.4.tar.gz
| Download URL | cbspy-0.0.4.tar.gz |
|---|---|
| Size | 148.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2493bf2364a6e34b6d932c1c04e9e7c2635fe375c041fbaeb24213b3e3ba59e7
|
|
BLAKE2b-256 checksum How to use checksums |
25fcb721ee8152cf0f0272e7bc9daa97a43dc98f2d431c11425966365f88171b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / cbspy-0.0.4-py3-none-any.whl
| Download URL | cbspy-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b3d68019dd32a3465d30d35a08f4e68ed0c1e9bbabaf3cba8549a3514fc6cdf
|
|
BLAKE2b-256 checksum How to use checksums |
478142a04ef8388b151f4cb90e5b2fb84ba6ae97520bebbda31314e2ffbbd995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|