dataseries: Switzerland's Data Series in One Place
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
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
File details
Details for the file dataseries-1.0.0.tar.gz.
File metadata
- Download URL: dataseries-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9293917bb7257afe6884cf6c07bd68a42b5d6cec80f5537bef230800d5d764cf
|
|
| MD5 |
6f4a71631894917933e29016af3a702c
|
|
| BLAKE2b-256 |
efbcd7698e5155ce328e8f0c356aba8aa9dc922ff6dc9a71763c666770da98de
|
Provenance
The following attestation bundles were made for dataseries-1.0.0.tar.gz:
Publisher:
release.yaml on cynkra/dataseries-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dataseries-1.0.0.tar.gz -
Subject digest:
9293917bb7257afe6884cf6c07bd68a42b5d6cec80f5537bef230800d5d764cf - Sigstore transparency entry: 2365511125
- Sigstore integration time:
-
Permalink:
cynkra/dataseries-py@65e1667de9a31160ca3ac37a9e8039a9eb9dca72 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/cynkra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@65e1667de9a31160ca3ac37a9e8039a9eb9dca72 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dataseries-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dataseries-1.0.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dc9499ea05931d32981289bc75485da6722380412fc785dafd5d9f6874862f6
|
|
| MD5 |
1452aa57e9a22c41371c911844a45c54
|
|
| BLAKE2b-256 |
9b21a024d1996dc08cba7e8a4a0770af67b5588a704f012b665c1291fd5f069e
|
Provenance
The following attestation bundles were made for dataseries-1.0.0-py3-none-any.whl:
Publisher:
release.yaml on cynkra/dataseries-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dataseries-1.0.0-py3-none-any.whl -
Subject digest:
4dc9499ea05931d32981289bc75485da6722380412fc785dafd5d9f6874862f6 - Sigstore transparency entry: 2365511169
- Sigstore integration time:
-
Permalink:
cynkra/dataseries-py@65e1667de9a31160ca3ac37a9e8039a9eb9dca72 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/cynkra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@65e1667de9a31160ca3ac37a9e8039a9eb9dca72 -
Trigger Event:
release
-
Statement type: