Special Elections: special-elections.csv

special-elections.csv contains data on all elections pitting at least one Democrat against at least one Republican between Jan. 20, 2017, and Mar. 27, 2018, including both state and federal special elections as well as regularly scheduled 2017 elections in New Jersey and Virginia (except for New Jersey General Assembly).

For each geography (district or state) the file contains:

Median household income.

The percentage of its residents over age 25 who possess a bachelor's degree or higher.

The improvement in the Democratic candidate's margin in the 2017 or 2018 special election over the district's normal partisan lean. (FiveThirtyEight defines "partisan lean" as the average difference between how a constituency voted in the past two presidential elections and how the country voted overall, with 2016 results weighted 75 percent and 2012 results weighted 25 percent.)

Two districts in New Hampshire (Belknap HD-09 and Hillsborough HD-44) did not have Census data available. Florida House District 44 and Louisiana House District 92 were excluded. These were districts where the Democrats dropped out at the last minute but their names remained on the ballot. Iowa House District 22 and Pennsylvania House District 197 were also excluded. In both of these districts, Democrats were not on the ballot but waged write-in campaigns instead.

Ballotpedia was used to compile the list of elections between Jan. 20, 2017 and March 27, 2018. Income and education data comes from the American Community Survey's five-year estimates for 2012–2016. Presidential results by district were collected from Daily Kos Elections (Florida results are from Matthew Isbell).