GithubHelp home page GithubHelp logo

election_analysis's Introduction

Election_Analysis (Using Python)

Overview of Election Audit

To assist a Colorado Board of Elections employee in an election audit of the tabulated results for the U.S. Congressional precinct in Colorado. The task is to review the data, in an automated way, to identify:

  • Total overall number of votes
  • A complete list of candidates who received votes
    • Total number of votes each candidate received
    • Percentage of votes each candidate won
    • The winner of the election based on popular vote
  • The voter turnout for each county
    • The percentage of votes from each county out of the total count
    • The county with the highest turnout

The data provided was in .csv format and had more than 350,000 results. In order to provide this employee with the results quickly, the use of Python programming language allowed for a script to be created to answer the questions the Board of Elections was expecting.

Resources

Election-Audit Results

The analysis showed that there were a total of 369,711 votes cast in the election. The results by county (reference county calculation script here):

  • Jefferson: 10.5% (38,855)
  • Denver: 82.8% (306,055)
  • Arapahoe: 6.7% (24,801)

Denver had the largest voter turnout at 82.8% (306,055) of all the counties represented.

The results by candidate:

  • Charles Casper Stockham received 23.0% of the vote and 85,213 number of votes.
  • Diana DeGette received 73.8% of the vote and 272,892 number of votes.
  • Raymon Anthony Doane 3.1% of the vote and 11,606 number of votes.

Of the candidates, Diana DeGette was the clear winner of the election with 73.8% (272,892) of the total votes cast.

Election-Audit Summary

The script created to provide the Board of Elections with the final results of Diana DeGette being the winner and Denver being the county with the largest voter turnout can be used to calculate future and/or past elections. Depending on the data source, the script can be easily modified to add additional metrics to the results. For example, if someone wanted to know what the voter turnout by gender was, then:

  • A list and dictionary would need to be added gender(), gendor_votes[]
  • Extract gender from the dataset gender_name = row[x]
  • Count the number of votes by gender gender_votes[gender_name] += 1,gender = gender_votes.get(gender_name),gender_percentage = float(gender) / float(total_votes) * 100

Another modification can be made based in user input. For example, if you wanted to isolate the results by year, the following code can be added to the beginning of the script:

print("What year would you like to see?"),Options = ("2017,"2018","2019"),user_choice = input("Make your Choice: 2017, 2018, or 2019?")

The possibilities are endless!

Election_Audit script can be found here

election_analysis's People

Contributors

amylio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.