Skip to content

pycensus.census.countries.usa.elections_precinct.unofficial.nyt_medsl

Precinct polygons from the New York Times 2024 precinct map joined to MEDSL precinct results by their vote counts -- UNOFFICIAL, cross-validated.

Neither source alone is official. They are independent compilations of the states' results, so a precinct whose Democratic and Republican counts agree EXACTLY in both (within one county, and unique there) is the same precinct. That gives MEDSL's labelled results (the state's own precinct names) the NYT polygon (official_boundary says whether the NYT used the state's/county's boundary). A state is accepted only if at least MIN_MATCHED of its presidential votes match; the MEDSL votes of precincts that do not match (and of rows with no polygon) are shared among the matched polygons of their county in proportion to votes, so every county keeps its MEDSL total (checked against Delaware's official report: 99.8% of votes matched).

match_report(st, cache_dir=None)

(GeoDataFrame of matched precincts with MEDSL votes, share of MEDSL presidential votes matched, official_boundary share).

Parameters:

Name Type Description Default
st str

State abbreviation (lower case).

required
cache_dir

Cache folder; None = the pycensus cache.

None

load(state_fips, cache_dir=None)

MEDSL 2024 presidential votes matched to NYT precinct polygons (by county and vote counts); unmatched votes spread over the county's matched polygons.

Parameters:

Name Type Description Default
state_fips str

2-digit state FIPS.

required
cache_dir

Cache folder; None = the pycensus cache.

None

Returns:

Type Description
GeoDataFrame

Precinct polygons with votes.

Raises:

Type Description
ValueError

If too few votes match.