gerda
Lightweight Python loader for the German Election Database (GERDA). Downloads and returns pandas DataFrames for German federal, state, local, mayoral, Landrat, county, and European Parliament elections (1945–2026), plus boundary crosswalks. Python port of the gerda R package.
Install
pip install gerda # base install (pandas)
pip install "gerda[polars]" # adds polars output support
Requires Python 3.11+.
Use
import gerda
# List all 47 datasets with geography, years, boundary target, and formats
catalog = gerda.datasets()
# Load federal county-level results
df = gerda.load("federal_cty_harm")
# Load harmonized municipal data and convert to polars
df = gerda.load("federal_muni_harm_25", as_polars=True)
# Force a fresh download (bypass cache)
df = gerda.load("federal_cty_harm", refresh=True)
# State-election results by constituency (Wahlkreis)
ltw = gerda.load("ltw_wkr_unharm")
# County-executive (Landrat) candidates
landrat = gerda.load("landrat_candidates")
# Annual county-council seat composition on current boundaries
seats = gerda.load("county_council_seats")
Files are downloaded from the GERDA data repository
and cached in a platform-specific user cache directory: ~/.cache/gerda/ on
Linux, ~/Library/Caches/gerda/ on macOS, %LOCALAPPDATA%\gerda\Cache\gerda
on Windows. The exact path is available at runtime:
from gerda.cache import cache_dir
print(cache_dir())
Cached files keep their original dataset names (e.g. federal_cty_harm.rds),
so it's safe to inspect or prune the cache by hand. RDS files are read with
pyreadr; column dtypes (notably
string AGS codes with leading zeros) are preserved automatically.
Dataset keys
The structured columns returned by gerda.datasets() can be used to select
datasets by election type, geographic level, years, boundary target, available
formats, and whether they contain candidate information.
federal_wkr_*: federal constituencies, keyed bywkr_nrand election year; long files additionally identify vote type (stimme) and party.ltw_wkr_*: state constituencies, keyed by state,wkr_nr, and election year; long files additionally identify vote type and party.landrat_unharm: county-executive elections, identified byags, election date, and round.landrat_candidatesadds person-level candidates.county_council_seats: annual county seat composition on fixed current county boundaries, identified by county and year.federal_cty_unharm: usecounty_codeandelection_year. The legacy aliasesagsandyearremain through Python gerda 0.6 and will be removed in v0.7.
Party crosswalk
Map GERDA party names to ParlGov attributes:
import gerda
gerda.party_crosswalk(["cdu", "spd", "linke_pds"], "left_right")
# 0 6.2503
# 1 3.6451
# 2 1.2152
# dtype: float64
gerda.party_crosswalk(["cdu", "afd"], "family_name_short")
# 0 chr
# 1 right
See gerda.crosswalk.destinations() for the full list of 21 destination
columns (party names, family, ideology scales, identifiers).
Scope
This package provides three workflows from the broader R package: load,
datasets, and party_crosswalk. The bundled INKAR / Zensus 2022 tables and
their merge helpers (add_gerda_covariates, add_gerda_census) are
intentionally not ported — Python users can do their own merges. If you
need them, use the R package.
Citation
Heddesheimer, Sichart, Wiedemann, and Hilbig. "German Elections Database (GERDA)." Scientific Data (2025). doi:10.1038/s41597-025-04811-5
Metadata
Release files for gerda 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gerda-0.2.0.tar.gz | 16.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gerda-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.7 kB
Release files / gerda-0.2.0.tar.gz
| Download URL | gerda-0.2.0.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb46991dde5ad77fc8d1f8ef5a74b3f05b6a17f8708bc57e258df4f7a708bc25
|
|
BLAKE2b-256 checksum How to use checksums |
4c766983fd0e4e32b54fb8f704a75b2edb4905c140e22a851e9aa62c4b60f84f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Jul 28, 2026.
Transparency logRelease files / gerda-0.2.0-py3-none-any.whl
| Download URL | gerda-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2899e63f05a536cf4f1c896492f841868d92c0e1740ca8f0ce4c2ebcef707ede
|
|
BLAKE2b-256 checksum How to use checksums |
fb2d2133044ca5920d144ac8175111f7916d2c543f8075c14370eb28c7f0d367
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Jul 28, 2026.
Transparency logSecurity for gerda 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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for gerda-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 Jul 28, 2026.
Transparency logA 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.