pycensus.census.countries.taiwan.elections¶
Taiwan Central Election Commission (中選會, db.cec.gov.tw) election results by village (村里) with H3 res-8 resampling.
Loaders: :func:load_presidential, :func:load_legislative, :func:load_mayor, :func:load_council -> ElectionResult(census, h3).
load_presidential(year=2024, **kw)
¶
President/VP ticket vote (party of the presidential candidate). Columns elec_national_<year>_*.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
Election year. |
2024
|
**kw
|
Passed to :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
The |
ElectionResult
|
class: |
load_legislative(year=2024, **kw)
¶
Legislative Yuan nationwide party-list vote (L4). Columns elec_national_<year>leg_* (suffix leg avoids clashing with the presidential).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
Election year. |
2024
|
**kw
|
Passed to :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
The |
ElectionResult
|
class: |
load_mayor(year=2022, **kw)
¶
Mayor / county magistrate election. Columns elec_municipal_<year>_* (party = candidate's party; leading independents get own column).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
Election year. |
2022
|
**kw
|
Passed to :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
The |
ElectionResult
|
class: |
load_council(year=2022, **kw)
¶
City/county council (regional constituencies, candidate votes summed by party). Columns elec_municipal_<year>council_*.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
Election year. |
2022
|
**kw
|
Passed to :func: |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
The |
ElectionResult
|
class: |
load_election(subject, legis, year, tag, counties=('63000',), level='village', data_dir=None, party_threshold=0.03, with_h3=True, candidate_party_column=True)
¶
Generic loader. subject/legis as in the module docstring (for county-vs-municipality pairs C1/C2, T1/T2 the right one is chosen per county).
Returns ElectionResult(census, h3): census keyed by GEOID (11-digit village; level='district' 8-digit, 'county_city' 5-digit)
with elec_<tag>_* columns; h3 keyed by h3_cell (res 8) with the same shares plus cnt_* count columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subject
|
str
|
CEC election subject code. |
required |
legis
|
str
|
CEC constituency code. |
required |
year
|
int
|
Election year. |
required |
tag
|
str
|
Column tag ( |
required |
counties
|
Iterable[str]
|
5-digit county codes. |
('63000',)
|
level
|
str
|
|
'village'
|
data_dir
|
Optional[str]
|
Folder of the raw downloads; |
None
|
party_threshold
|
float
|
Parties above this share get their own columns. |
0.03
|
with_h3
|
bool
|
Also build the H3 frame. |
True
|
candidate_party_column
|
bool
|
Use the candidate's party as the party. |
True
|