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.1.tar.gz (135.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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file cbspy-0.0.1.tar.gz.

File metadata

  • Download URL: cbspy-0.0.1.tar.gz
  • Upload date:
  • Size: 135.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.1.tar.gz
Algorithm Hash digest
SHA256 c65f543101d7d2edc081f818e6cc4461aed3edc9e59bb98cf2c9ffa45dda1c97
MD5 d89764e48ab7c12a04df3c0504c68b12
BLAKE2b-256 6a148207b1959dc23b2b58adf8c2c8ea647fa739fdf693d3948706d61205c57c

See more details on using hashes here.

File details

Details for the file cbspy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cbspy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a345e9321ad1bfd7729aa9622266b1db7186f9143d30676daeaf7120a8a3357
MD5 9458f3a851802490a1c06d3a2fdbdbd2
BLAKE2b-256 1a8c497f0157eaefd6c7026225b5a1768d2c8ebd968e12ba09825b4536378cc4

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