How the per-election-district mayoral primary results on this site are constructed, and what they do and don't represent.
NYC election district (ED)-level results for the 2021 and 2025 Democratic mayoral primaries, including both first-choice tallies and ranked-choice voting (RCV) final-round tallies. The Board of Elections does not publish either of these at the ED level for citywide ranked-choice races; both are computed here from the official Cast Vote Record (CVR) files.
| Data | Source | Format |
|---|---|---|
| 2021 Democratic primary CVR | vote.nyc | Zip of XLSX, 109 MB |
| 2025 Democratic primary CVR | vote.nyc | Zip of XLSX, 90 MB |
| Election district boundaries | NYC Open Data h2n3-98hq via DCP ArcGIS REST | GeoJSON, 4,247 EDs |
| Candidate ID → name map | Included in each year's CVR ZIP | XLSX |
Each CVR ZIP contains 25–32 XLSX files, one per borough × ballot-channel (election day, absentee, affidavit, early voting, emergency). Each row is one ballot; columns include the ballot's precinct (formatted AD: NN ED: NNN) and one column per (race, choice rank), e.g. DEM Mayor Choice 1 of 5 Citywide. Cell values are either a candidacy ID (integer), undervote, overvote, or Write-in.
For each year we extract precinct + the five DEM Mayor choice columns from every file, drop ballots with no DEM Mayor vote in any of the 5 ranks, and parse the precinct string into a single integer ED ID matching the shapefile field ElectDist (= AD × 1000 + ED).
For each ED, count ballots by their Choice 1 candidate (excluding undervotes, overvotes, and write-ins, which BOE reports separately). Percentages on the map are share of first-choice votes cast in that ED for a named DEM candidate, not share of all ballots.
This site uses the standard citywide-elimination approach — the same approach BOE uses to certify the official final-round tallies. The procedure is:
The 2021 finalists are Eric Adams and Kathryn Garcia. The 2025 finalists are Zohran Mamdani and Andrew Cuomo. In the "RCV final" view, eliminated candidates show 0% in every ED — they did not survive to the final round. To see geographic strength of an eliminated candidate, use the "First choice" view.
Each ED's results are joined to the 2024–2025 vintage of the NYC ED shapefile by integer ED ID. Both 2021 and 2025 elections were conducted under the post-2010-Census ED boundaries; while individual EDs occasionally split or merge between primaries, the great majority remain identical. EDs in the shapefile with no ballots in the CVR (typically retired or empty EDs) are dropped; ballots with an ED ID not present in the shapefile (typically formatting anomalies in the CVR) are also dropped — both counts are logged in the build pipeline.
All code, raw inputs, and normalized intermediates are in github.com/joshgreenman1973/nyc-election-archive. The pipeline is four scripts in data-pipeline/:
fetch_shapefile.py — paginated download of the ED shapefile from NYC DCP ArcGIS REST.normalize_cvr.py — extracts DEM Mayor ballots from each year's CVR ZIP into a single CSV.build_results.py — per-ED first-choice counts and per-ED RCV resolution.build_geo.py — joins results to the shapefile, emits one compact GeoJSON per election plus the manifest the frontend reads.Last updated: 2026-04-25.