A repository for interacting with and manipulating data from CBS Statline.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cbspy-0.0.4.tar.gz
(148.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cbspy-0.0.4-py3-none-any.whl
(7.8 kB
view details)
File details
Details for the file cbspy-0.0.4.tar.gz.
File metadata
- Download URL: cbspy-0.0.4.tar.gz
- Upload date:
- Size: 148.5 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2493bf2364a6e34b6d932c1c04e9e7c2635fe375c041fbaeb24213b3e3ba59e7
|
|
| MD5 |
cad76ddbd681c9a0fd33b299ad58fa06
|
|
| BLAKE2b-256 |
25fcb721ee8152cf0f0272e7bc9daa97a43dc98f2d431c11425966365f88171b
|
File details
Details for the file cbspy-0.0.4-py3-none-any.whl.
File metadata
- Download URL: cbspy-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b3d68019dd32a3465d30d35a08f4e68ed0c1e9bbabaf3cba8549a3514fc6cdf
|
|
| MD5 |
ffaf1a8052a3ce28dafc70c69b0151fa
|
|
| BLAKE2b-256 |
478142a04ef8388b151f4cb90e5b2fb84ba6ae97520bebbda31314e2ffbbd995
|