Jess Chace

Investigator | Data Scientist

Voter Registration by New York Congressional Districts for 2018 Midterm Elections

Category » Python

Analysis of Voter Registration for the 27 New York Congressional Districts in anticipation of the 2018 Midterm Elections with interactive Dash charts.

In anticipation of the 2018 mid-term elections, Enigma Public is hosting a data science competition. Using their new SDK package which facilitates API calls on their public database, contestants are encouraged to explore topics that have some explanatory power over the midterm elections. The competition ends on Friday, September 21, 2018.

Under their Elections collection, there are six umbrella datasets: Congressional Candidate Disbursements, Federal Election Commission, New York State Board of Elections, PAC Summary, Presidential Campaign Disbursements, and Tafra. While there’s definitely something to dig into in each of these datasets, I chose to explore the New York State Board of Elections dataset filled with 5 years of voter registration statistics by Congressional District.

I initially started off this analysis plotting in Matplotlib but halfway through decided to challenge myself and build out my plots using Dash. I wanted to do this for several reasons: First, I’ve used Plotly in a previous project and was really impressed with the interactive hover-over feature and the crispness of the colors. With Plotly-Dash, I was able to take the user interaction to the next level by including drop-down menus to facilitate more focused analysis. Second, I felt like building out interactive plots like the ones below encourage engagement with the data as opposed to just reading someone’s findings. I can’t think of a better topic than election season to get people engaged with data and thinking about their right to vote. Also, the kid in me really likes pushing the buttons.

Have a click through the charts below and feel free to share your own findings in the comments section.

Voter Registration across Political Parties from 2014-2018

The chart below displays voter registration numbers for all 27 districts of New York which can be filtered by year using the drop-down menu. Click on any combination of the boxes in the legend to compare voters across political parties. Here are a few questions to get you started on your analysis: Did the Democrats lose any districts to the Republicans? If so, where and when? What’s the greatest party affiliation after the Democrats and Republicans? Does that political affiliation represent opportunity or apathy? Where does the Independent Party have the most registered voters? What other trends can you see?


Percentage Change of Voter Registration

Sometimes it’s not enough to just look at the numbers themselves but to actually calculate how the numbers have changed from year to year. Using the .pct_change() in Pandas, I was able to identify the percentage change of voter registration across the political parties. This analysis produced some interesting results, especially as it relates to the fringe parties of New York, namely, the Women’s Equality Party (WEP) and the Reform Party (REF).

Founded in 2014, the Women’s Equality Party (WEP) was created by Andrew Cuomo, the current governor of New York. The party reached full political party status in 2014 during the gubernatorial elections after receiving the requisite 50,000 votes. While Cuomo is no longer in control of the party on paper, the party remains deeply supportive of the incumbent governor, supporting his most recent re-election bid in 2018.

The Reform Party (REF), another fringe political party founded in 2014, is a ballot-access qualified party created by Curtis Sliwa. Silwa initially founded another group called the Guardian Angels in 1979 and is a regular contributor to several talk radio and television shows, including Fox 5.

Click through the chart below to see how each district has responded to the introduction of these new parties. Do you see any patterns emerging across districts that are represented by a Democrat as opposed to a Republican?


Active v. Inactive Voters in 2018

Counting the number of registered voters, however, does not equate to how many people will actually vote. In the 2016 Presidential election, for example, 58% of eligible voters cast a ballot. So how can you tell if someone will vote or not? One way to identify potential voter turnout is to take a look at the active and inactive voter registration1. Voters who are active are more likely to show up to the polls than are inactive voters.

Click through the chart below to see the breakdown of active and inactive voters across all districts for each party in 2018. Is there a party that is consistently active across all districts? Which party is the most inactive? Who’s more active between the Democrats and Republicans? Thinking back to the fringe parties percentage change chart, what do you think it means that a newly founded fringe party has inactive voters?


Final Thoughts

The 2018 midterm elections are significant for a number of different reasons. Republicans retaining control of both the Senate and the House of Representatives means they will be able to continue pushing a more conservative agenda that may include trying to repeal Obamacare again, cutting budgets for social services like welfare, Medicare, and Social Security, and restricting access to abortion. Moreover, because many gubernatorial and state legislature elections determine how state districts are drawn, whoever is elected will be able to help shape congressional district boundaries in the upcoming 2020 Census, and those boundaries will be in effect for the following ten years. Here’s an interactive map created by the Washington Post detailing who determines how congressional districts are drawn for each state.

Many of the 2018 Midterm elections will be held on Tuesday, November 6, 2018. All 435 seats in the United States House of Representatives and 35 of the 100 seats in the United States Senate will be contested.2 Vote early and vote often.


  1. A voter in inactive status who does not vote in two consecutive Federal Elections is, in the fifth year, removed from the list of the register. The voter must re-register in order to vote. 

  2. https://en.wikipedia.org/wiki/United_States_elections,_2018