pycensus.census.countries.israel.elections.loader¶
Israel Knesset results by ballot box (kalpi) -> H3 res 8 -> CBS statistical areas.
Sources (official Central Elections Committee data, republished on data.gov.il; the CKAN datastore JSON API is open, whereas the CSV
download links and votes25.bechirot.gov.il / gov.il sit behind a CloudFront/WAF 403 for scripted clients and are NOT used):
results per kalpi https://data.gov.il/api/3/action/datastore_search?resource_id=cc223336-07bc-485d-b160-62df92967c0a (Knesset 25, 1 Nov 2022;
dataset 'votes-knesset'; other Knesset terms have their own resource ids in RESOURCES)
polling places https://data.gov.il/api/3/action/datastore_search?resource_id=68c4d7e8-2218-48ee-996f-2db2f72b2395 (dataset 'voting-polls':
street, house number, venue name per locality symbol and kalpi*10)
No published geometry for ballot boxes or statistical areas exists, so polling-place ADDRESSES are geocoded with OSM Nominatim (cached; venue name tried
first, then street+number, then street). Positional error is typically 100-500 m: results are therefore a polling-station-location surrogate of where
voters live, not residential results. Kalpi without a polling-place record (code mismatch between the 2022 result file and the 2023 list) borrow the location of the
numerically nearest located box (reported in attrs['borrowed_location_share']).
Pipeline: kalpi counts -> H3 res 8 cell of the geocoded point (sum) -> CBS 2022 statistical areas by AREA-WEIGHTED split of each cell's counts over
the polygons it overlaps (counts rescaled so each locality total is conserved) -> shares recomputed from counts.
Municipal (local authority) results: not obtainable, see :func:load_local_authorities.
load_knesset(election=25, localities=(9000,), data_dir=None, party_threshold=0.03)
¶
Knesset election results for localities (CBS locality symbols; 9000 = Beersheba).
Returns ElectionResult(census, h3): census keyed by 8-digit CBS statistical-area GEOID (same GEOIDs as
israel.geography.load_boundaries('statistical_area', ...)), h3 keyed by h3_cell (res 8) with shares and cnt_* counts.
Columns: elec_national_<year>_{total_votes,turnout_rate,left_share,right_share,other_share,party_<slug>_share} (total_votes = valid votes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
election
|
int
|
Knesset number (e.g. 25). |
25
|
localities
|
Iterable[int]
|
CBS locality symbols. |
(9000,)
|
data_dir
|
Optional[str]
|
Folder of the raw downloads; |
None
|
party_threshold
|
float
|
Parties above this share get their own columns. |
0.03
|
Raises:
| Type | Description |
|---|---|
ValueError
|
For a Knesset not wired. |
load_knesset_localities(election=25, localities=(9000,), data_dir=None, party_threshold=0.03)
¶
Knesset results summed over each locality's ballot boxes (no geocoding): one row per CBS locality symbol (GEOID), the same
elec_national_<year>_* columns as :func:load_knesset. For the localities without statistical areas (most of them) and as the
fallback of those with them. A locality with no ballot-box rows is left out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
election
|
int
|
Knesset number (e.g. 25). |
25
|
localities
|
Iterable[int]
|
CBS locality symbols. |
(9000,)
|
data_dir
|
Optional[str]
|
Folder of the raw downloads; |
None
|
party_threshold
|
float
|
Parties above this share (of the localities together) get their own columns. |
0.03
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame keyed by |
Raises:
| Type | Description |
|---|---|
ValueError
|
For a Knesset not wired. |
load_local_authorities(*args, **kw)
¶
Not available: the Interior Ministry / Central Elections Committee local-authority (mayor + council) results by ballot box (Feb 2024 round) are only on gov.il / bechirot.gov.il pages that answer scripted clients with an HTTP 403 WAF block, and data.gov.il has no local-election results dataset (only polling-place lists). Not circumvented; see the module report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
Ignored. |
()
|
|
**kw
|
Ignored. |
{}
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always. |