Data
Comparative Electoral Indices (2023–2026)
A comparator of turnout, fragmentation, disproportionality, party families and volatility for the 29N 2026 and 23J 2023 general elections, the Madrid and Valencian Community pilots and the 8,087 municipalities of the 2023 local elections.
Query the full database in your browser: filters, prepared queries, free SQL and CSV export.
Open the comparator →How to cite
Mayordomo Hernández, S. (2026). Comparative Electoral Indices, 2023–2026 [dataset]. politicacomparada.org. https://politicacomparada.org/en/data/indices-electorales/
Status
Published on 30 November 2026. The 29N is provisional; the 23J is final. The Madrid and Valencian Community pilots and the municipal tab use 2023 data.
The comparator brings together the indices calculated by the engine in scripts/indices/. It is not a microdata dataset: it publishes values aggregated by level, municipality, party and family. The municipal tab loads its own 6.8 MB JSON so the landing page stays light.
What it includes
- National: 23J 2023 and 29N 2026 Congress elections; 14 indices (turnout, invalid and blank ballots, effective number of parties by votes and seats, Gallagher, Loosemore–Hanby, seat bonus, vote and seat margins, wasted votes, malapportionment, nationalisation and competitive districts), parties with seats and party families.
- Madrid 2023: 179 municipalities and the Community of Madrid; 28M municipal elections, the Madrid Assembly and the 23J; turnout, fragmentation, disproportionality, margins, volatility, seats and families. 6,318 indices.
- Valencian Community 2023: 542 municipalities and the Community; municipal elections, Les Corts and the 23J; vote-based indices (turnout, ENP, margins and gaps). 11,403 indices. The source does not publish municipal seats, so this pilot does not include Gallagher, seat ENP or women elected.
- Municipal 2023: 8,087 municipalities and 5,423 harmonised candidacies; 21 indices per municipality, 169,827 values, 66,976 seats and 27,209 women elected. Includes the compact SQLite database with participation, results, families and indices, without personal candidate data or polling-station detail.
- Volatility 23J→29N: Pedersen by party and by family, in votes and seats.
JSON structure
| Key | Contents |
|---|---|
meta |
Version, generation date and sources. |
families / family_order |
Party-family names and order. |
indexes |
Label, unit, dimension and description of each index. |
national |
23j, 29n and volatility; values, parties and families. |
madrid / valencia |
meta, entities, values, statuses, families and results. |
municipal-2023.json |
entities (8,087 municipalities), indexes, national, provinces and families. Each entity carries its indices, families and top three candidacies. |
municipales-2023.sqlite |
Compact database: processes, municipalities, candidacies, participation, results, families, indices and upper-level results. |
In Madrid and Valencia, values[code][election][index] holds the value; statuses records no_data; families[code][election] holds each family’s vote share; and results[code][election] holds votes and, for Madrid, seats by party. The code CM identifies the community aggregate.
How it is built
Results data are downloaded from official sources and validated before the indices are calculated. The 23J is extracted from the comparison count on the 29N portal; Madrid uses the Community of Madrid’s CKAN resources; Valencia uses ODS/CSV files from dadesobertes.gva.es and the electoral cartography WFS. The municipal database is built from the Ministry’s fixed-width files (nnxxaamm.DAT). The shared engine lives in scripts/indices/, and the comparator is generated with:
npm run indices:comparator:build
npm run municipales:all
npm run municipales:public
The 29N database is provisional and may change with the final count. JSON and results-database checksums are published on the corresponding dataset pages.
Limitations
- The 29N is provisional; the 23J is final.
- Madrid publishes municipal votes in seven categories; “Rest of parties” aggregates local candidacies. Women elected is completed from the Ministry candidate files for all 179 municipalities.
- Valencia does not publish municipal seats: representation indices and women elected are unavailable in that pilot. Local families are approximate.
- Municipal, regional and national electorates are not identical; turnout gaps should be read with caution.
- Comparing the 23J (July) with the 28M (May) is descriptive, not causal.
- Party families are an auditable draft; local lists remain in “Local / other”. The Madrid tab and the municipal database share the classification: Más Madrid-Verdes Equo, Comuns and En Comú are green-left.
- In municipalities with 250 inhabitants or fewer, votes are ballots; candidate votes are kept separately and must not be added without stating it.
- The compact SQLite excludes individual candidates and polling-station detail; the full database is only used in the build environment.
- The indices do not replace the official count or the minutes.
Sources
- 29N 2026 results (Spanish Ministry of the Interior).
- Community of Madrid open data.
- Generalitat Valenciana open data.
The concepts and formulas are explained in Methodology → Electoral indices. The technical documentation is in docs/indices-electorales.md (Spanish).