Skip to content

pycensus.census.countries.germany.elections.loader

Hamburg election results at Wahlbezirk (Stimmbezirk) level + H3 res 8: Bundestag 23-02-2025, Buergerschaft 02-03-2025, Bezirksversammlungen 09-06-2024.

Sources (verified live 2026-10-25; Statistik Nord / Landeswahlleitung Hamburg, official final results; data licence dl-de/by-2.0): Buergerschaft 2025 (state) https://www.wahlen-hamburg.de/B%C3%BCrgerschaftswahl_2025/ergebnis-download-land.csv (+ Landesliste_F_Feldbezeichner.xlsx) Bundestag 2025 (national) https://www.wahlen-hamburg.de/Bundestagswahl_2025/ergebnis-download.csv (+ BTW2025_Feldbezeichner_Erst-_Zweitstimmen.xlsx) Bezirksversammlungen 2024 (municipal; Hamburg's 7 districts = municipal level) https://www.wahlen-hamburg.de/bezirksversammlungswahlen_2024/ergebnis-download-bezirk.csv (+ Feldbezeichner_Download_2024_Bezirksstimmen.xlsx) Geometry: Wahlbezirke polygons (1,272, vintage 02-03-2025), WFS https://geodienste.hamburg.de/HH_WFS_Wahlen layer de.hh.up:wahlbezirke (Transparenzportal "Geodaten zu Wahlen von Hamburg"). wahlbezirksnummer == Erfassungsgebietsnummer (5 digits); 1,268/1,269 match (15001 = special district without polygon, 0 votes). The 2025 polygons are also used for Bundestag 2025 (same numbers) and Bezirksversammlung 2024 (all 1,268 numbers present; boundaries may differ slightly). Votes: Bundestag = Zweitstimmen (Listenstimmen); Buergerschaft = Landesstimmen and Bezirksversammlung = Bezirksstimmen, party "Gesamtstimmen" (list + personal votes); voters have 5 votes there, so total_votes counts votes (not voters); shares are of valid votes. Invalid ballots are excluded, blank = 0. Postal votes: published for Briefwahlbezirke without geography (~40 % of votes). They are allocated to the Stimmbezirke of the SAME Stadtteil in proportion to the Stimmbezirke's electors with Wahlschein (A2, fallback A). Electors = A of the Stimmbezirke; turnout = (voters in Stimmbezirke + allocated postal voters)/electors. GEOID = 5-digit Wahlbezirk number as string. Hamburg Statistische Gebiete / Zensus 100 m grid are not used as keys (Wahlbezirke do not nest in them): use the H3 frame. H3 res 8: area-weighted split of each Wahlbezirk (see pycensus.elections).

load_wahlbezirke(data_dir=None)

Hamburg's 2025 electoral districts (Wahlbezirke) from the city's WFS, one polygon per number.

Parameters:

Name Type Description Default
data_dir Optional[str]

Folder of the raw downloads; None = the pycensus cache.

None

Returns:

Type Description

GeoDataFrame with GEOID and geometry.

load_election(scope, year, level='wahlbezirk', data_dir=None, min_share=0.03)

scope/year: ('national', 2025) Bundestag, ('state', 2025) Buergerschaft, ('municipal', 2024) Bezirksversammlungen. level: 'wahlbezirk' (GEOID, 5-digit string) or 'h3' (h3_cell, res 8).

Parameters:

Name Type Description Default
scope str

"national", "state" or "municipal".

required
year int

Election year.

required
level str

"wahlbezirk" or "h3".

'wahlbezirk'
data_dir Optional[str]

Folder of the raw downloads; None = the pycensus cache.

None
min_share float

Parties above this share get their own columns.

0.03

Returns:

Type Description
DataFrame

The election frame.

load_bundestag_2025(level='wahlbezirk', data_dir=None)

Bundestag election 2025 in Hamburg (see :func:load_election).

Parameters:

Name Type Description Default
level

"wahlbezirk" or "h3".

'wahlbezirk'
data_dir

Folder of the raw downloads; None = the pycensus cache.

None

Returns:

Type Description

The election frame.

load_buergerschaft_2025(level='wahlbezirk', data_dir=None)

Hamburg Bürgerschaft election 2025 (see :func:load_election).

Parameters:

Name Type Description Default
level

"wahlbezirk" or "h3".

'wahlbezirk'
data_dir

Folder of the raw downloads; None = the pycensus cache.

None

Returns:

Type Description

The election frame.

load_bezirksversammlung_2024(level='wahlbezirk', data_dir=None)

Hamburg district assembly elections 2024 (see :func:load_election).

Parameters:

Name Type Description Default
level

"wahlbezirk" or "h3".

'wahlbezirk'
data_dir

Folder of the raw downloads; None = the pycensus cache.

None

Returns:

Type Description

The election frame.