Skip to main content

A repository for interacting with and manipulating data from CBS Statline.

Project description

cbspy

Release Build status codecov License

A modern Python client for CBS Statline open data that returns Polars DataFrames with human-readable column names.

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


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)

Uploaded Source

Built Distribution

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

cbspy-0.0.4-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

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

Hashes for cbspy-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2493bf2364a6e34b6d932c1c04e9e7c2635fe375c041fbaeb24213b3e3ba59e7
MD5 cad76ddbd681c9a0fd33b299ad58fa06
BLAKE2b-256 25fcb721ee8152cf0f0272e7bc9daa97a43dc98f2d431c11425966365f88171b

See more details on using hashes here.

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

Hashes for cbspy-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1b3d68019dd32a3465d30d35a08f4e68ed0c1e9bbabaf3cba8549a3514fc6cdf
MD5 ffaf1a8052a3ce28dafc70c69b0151fa
BLAKE2b-256 478142a04ef8388b151f4cb90e5b2fb84ba6ae97520bebbda31314e2ffbbd995

See more details on using hashes here.

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