How the per-election-district mayoral results on this site are constructed, and what they do and don't represent.
New York City election district (ED)-level results for the 2017, 2021 and 2025 mayoral general elections and the 2021 and 2025 Democratic mayoral primaries. For the primaries the site shows both first-choice tallies and ranked-choice voting (RCV) final-round tallies. The Board of Elections (BOE) 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. The general elections were not ranked-choice races; their results come from BOE's published ED-level results files on vote.nyc and have a single round.
| 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, 2025 elections | NYC Open Data h2n3-98hq via DCP ArcGIS REST | GeoJSON, 4,247 EDs as downloaded in April 2026 (the live file, updated Aug. 21, 2026, has 4,214) |
| Election district boundaries, 2021 elections | City Planning release 21A (February 2021), added by hand | GeoJSON, 5,839 EDs |
| Election district boundaries, 2017 election | City Planning; which release is not recorded; added by hand | GeoJSON |
| General election results, 2017, 2021 and 2025 | BOE ED-level results files (EDLevel CSV) on vote.nyc | CSV |
| 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 election's results are joined by integer ED ID to a boundary file from its own period, because ED lines changed between these elections: the results list 5,759 EDs for the 2017 general, 5,725 for the 2021 general and 4,117 for the 2025 general. The 2017 general is joined to ed_shapefile_2017.geojson, the 2021 primary and general to ed_shapefile_2021.geojson, and the 2025 primary and general to the current City Planning file that fetch_shapefile.py downloads. The 2017 and 2021 files are older City Planning election district boundaries that were added to data/raw/ by hand; the pipeline does not download them. The 2021 file is City Planning's release 21A (February 2021, 5,839 EDs); the repo does not record which release the 2017 file is. EDs in a boundary file with no results are dropped, as are results with an ED ID not in the boundary file; build_geo.py logs both counts.
All code and normalized intermediates are in github.com/joshgreenman1973/nyc-election-archive. The raw inputs are not; data/raw/ is excluded from the repo. The README's commands download the CVR ZIPs and the current boundary file; the 2017 and 2021 boundary files and the EDLevel CSVs have to be obtained separately. The pipeline is five scripts in data-pipeline/:
fetch_shapefile.py — paginated download of the ED shapefile from the Department of City Planning's ArcGIS REST service.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.normalize_edlevel.py — turns BOE's ED-level results file for each general election into the same per-ED CSVs, summing candidates who ran on more than one party line.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.