Skip to main content

sistat

A small Python client for SiStat, the statistical database of the Statistical Office of the Republic of Slovenia (SURS). Use it to search tables, inspect their variables, and download data as plain records, ready for pandas, polars or anything else.

SiStat runs PxWeb, whose v1 API is documented in SURS's API help (PDF).

Install

pip install sistat

It depends on pxweb-client, a generic PxWeb v1 client, and httpx.

Usage

import sistat

c = sistat.Client(lang="en")          # or "sl"

c.search("air temperatures")          # case- and accent-insensitive, searched locally
# [TableInfo(id='0156101S.px', text='Average annual and monthly air temperatures [°C] by ...', ...)]

meta = c.metadata("0156101S")         # the ".px" suffix is optional
for v in meta.variables:
    print(v.code, "|", v.text, "|", v.value_texts[:3])
# METEOROLOŠKA POSTAJA | METEOROLOGICAL STATION | ('SLOVENIA', 'Bilje', 'Bovec')
# OBDOBJE, LETO | PERIOD, YEAR | ('1981-1990', '1991-2000', '2001-2010')
# MERITVE | MEASURE | ('Average temperature - ANNUAL', 'January', 'February')

records = c.get_records(
    "0156101S",
    {
        "METEOROLOGICAL STATION": ["Ljubljana, Bežigrad", "Maribor, Tabor"],
        "PERIOD, YEAR": "201*",
    },
)
# [{'METEOROLOGICAL STATION': 'Ljubljana, Bežigrad', 'PERIOD, YEAR': '2010',
#   'MEASURE': 'Average temperature - ANNUAL', 'value': 10.7}, ...]

import pandas as pd                   # or polars: pl.DataFrame(records)
df = pd.DataFrame(records)
#   METEOROLOGICAL STATION  PERIOD, YEAR                       MEASURE  value
# 0    Ljubljana, Bežigrad          2010  Average temperature - ANNUAL   10.7
# ...

Selections

Keys are variables, given as their code (often Slovenian, even in the English API) or their label, case-insensitively. Values can be:

Selection Meaning
"Ljubljana, Bežigrad" or "10" one value, by label or code
["10", "Maribor, Tabor"] several values
"2020*", "*" glob pattern over codes and labels
"top:5" the first 5 values in the table's order

The library sends every variable you leave out with all its values selected. PxWeb would otherwise drop it from the result without telling you.

Pass codes=True to also get a <variable>_code key with the raw value codes. Queries that exceed the server's cell limit are split into several requests and merged. Requests are kept under the server's rate limit automatically.

Layout

sistat.Client adds SiStat specifics (the base URL, table-id normalisation, cached table search) on top of pxweb-client, which does the PxWeb v1 work: resolving selections, splitting queries at the cell limit, rate limiting, and turning responses into records. Errors are pxweb's (PxWebError, APIError, QueryError), re-exported by sistat. See ADR 0001 for why they are separate.

Development

uv sync
uv run pytest            # offline tests against recorded fixtures
uv run pytest -m live    # hits the real API
uv run ruff check .

Data © SURS, see their terms of use.

Metadata

Release files for sistat 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sistat 0.2.0
File Size Uploaded Provenance Actions
sistat-0.2.0.tar.gz 7.5 kB With provenance Details for sistat-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sistat 0.2.0
File Interpreter ABI Platform Actions
sistat-0.2.0-py3-none-any.whl Python 3 none any Details for sistat-0.2.0-py3-none-any.whl

Total release size: 13.3 kB

Release files / sistat-0.2.0.tar.gz

Download URL sistat-0.2.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
777c91cb790895b5c9171b93e3a56a672fd55eb3e65ce62e16c6b8685b5052b4
BLAKE2b-256 checksum
How to use checksums
668b729e8fe689fd6de23a352edfa6085a40eee10086a34ada82a198e988021f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / sistat-0.2.0-py3-none-any.whl

Download URL sistat-0.2.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bb500b61937bcf798246e91ed948f2c4c58801953347a94076162b47bb3d32a
BLAKE2b-256 checksum
How to use checksums
a0c581f566fbbdf2b04e382e7b94e4016c44e4f229ca8462a3f1964b0b98ab7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for sistat 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sistat-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page