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.3.tar.gz
(147.1 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.3-py3-none-any.whl
(7.1 kB
view details)
File details
Details for the file cbspy-0.0.3.tar.gz.
File metadata
- Download URL: cbspy-0.0.3.tar.gz
- Upload date:
- Size: 147.1 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 |
a502e4838ec558e7095d7c851a4d2bdf66b999e88cda117fdb0be7cc7779459a
|
|
| MD5 |
1bf61364f8fa88d61e2a4f68aea8d79e
|
|
| BLAKE2b-256 |
14dd029a5e0dc1091686882153ad4b7f5f79b6bf0b21fa27728e6ba1ce229c18
|
File details
Details for the file cbspy-0.0.3-py3-none-any.whl.
File metadata
- Download URL: cbspy-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.1 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 |
466a4cb56b6ee8fbf07648a60db8a787230aeb1f1d10499a07908da1139321d3
|
|
| MD5 |
6dc6cece6d68615c63e7d0db9a4a3a0f
|
|
| BLAKE2b-256 |
40935ddea27b7b5f33e8f22dc00855e01e3cd308e21f94ec17a0579eada57bc7
|