Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dataseries: Switzerland's Data Series in One Place

PyPI CI

Download and import open Swiss economic time series from dataseries.org, a comprehensive and up-to-date collection of public data from Switzerland. The package talks to the public dataseries.org API and imports series as pandas DataFrames.

An R package with the same interface is available on CRAN.

Installation

pip install dataseries

Requires Python ≥ 3.9 and pandas.

Data model

Data on dataseries.org is organized into datasets. A dataset is a family of related series and, in most cases, a multi-dimensional cube — a single time series is one cell of that cube, addressed by the dataset plus one code per dimension. For example the GDP dataset (ch_seco_gdp) splits along three dimensions: type (nominal/real/…), structure (GDP, value added, …) and seas_adj (seasonally adjusted or not).

  • ds_catalog() lists every dataset.
  • ds_search(pattern) is a flat, searchable list of the individual series.
  • ds_meta(id) describes a dataset's dimensions and the codes within them.
  • ds(id, ...) downloads series.

Usage

import dataseries

# Browse what's available
dataseries.ds_catalog()

# Find a specific series across all datasets
dataseries.ds_search("unemployment")

# A dataset's dimensions and codes
dataseries.ds_meta("ch_seco_gdp")

# Whole dataset (long DataFrame)
dataseries.ds("ch_fso_cpi")

# One series: pass dimension codes as keyword arguments
dataseries.ds("ch_fso_cpi", item="100_100")

# Several series, restricted to a date range
dataseries.ds("ch_fso_cpi", item=["100_100", "100_1"], start="2020-01-01")

# One cell of a multi-dimensional cube, as a wide DataFrame indexed by date
dataseries.ds("ch_seco_gdp", type="real", structure="gdp", seas_adj="csa",
              wide=True)

The long format (the default) has the dimension column(s), then date (datetime) and value (float) — ready for groupby, seaborn or plotly. wide=True pivots to one column per series with a DatetimeIndex, the shape you want for .plot() or statsmodels. All series are regular (annual, quarterly or monthly); convert with e.g. .to_period("Q") if you prefer a PeriodIndex.

Dimension arguments are optional: omit them and you get the whole dataset. Filtering happens on the server, so selecting one series does not download the whole cube. Downloads are cached in memory for the session; dataseries.cache_clear() forces a fresh download.

Labels in German, French or Italian

The catalog and search index are translated. Pass lang to get titles and labels in any Swiss national language (falls back to English where a translation is missing):

dataseries.ds_catalog(lang="de")
dataseries.ds_search("arbeitslosigkeit", lang="de")

From search hit to data

ds_search() returns exactly the columns you feed back to ds():

hits = dataseries.ds_search("consumer price")
row = hits.iloc[0]
df = dataseries.ds(row["dataset"], {row["dim"]: row["code"]})

Beyond Python

Every series is also available as a plain CSV from any tool that can read a URL:

https://api.dataseries.org/series.csv?dataset=ch_fso_cpi&dims=item=100_100

Self-hosting or testing against a mirror? Point the package elsewhere with the DATASERIES_API environment variable.

License

MIT. The data itself is published by the Swiss data providers under their respective terms; see the license column in ds_catalog() and the source links in ds_meta().

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataseries-1.0.0rc1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

dataseries-1.0.0rc1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file dataseries-1.0.0rc1.tar.gz.

File metadata

  • Download URL: dataseries-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dataseries-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 79f727f232b84b043115b90d33513a04805b71c55db40ba4ca59bd69602234d5
MD5 3e55ffb0cf7ad25ffc6bbe5a3bb68d8a
BLAKE2b-256 337c362983a4b389363c0e38bcd11707c80a40273b51be8f4da314fc7dfcdf6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataseries-1.0.0rc1.tar.gz:

Publisher: release.yaml on cynkra/dataseries-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dataseries-1.0.0rc1-py3-none-any.whl.

File metadata

  • Download URL: dataseries-1.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dataseries-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 e94aba3d58841560721aef36f8c284a385f10b39ed2597381ddc02130c8db44d
MD5 2e352a268dec7169a084aa746bc7a63b
BLAKE2b-256 1300e6951a7a099a7d28ee8910a79f3eae5c6aead2c6e04f55dcc2ec5f9fdcff

See more details on using hashes here.

Provenance

The following attestation bundles were made for dataseries-1.0.0rc1-py3-none-any.whl:

Publisher: release.yaml on cynkra/dataseries-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page