Git Product home page Git Product logo

03-election-analysis-lukeperrin's Introduction

Module 3 | Assignment - PyPoll

Overview of Election Audit

Seth and Tom are looking to count votes for a local Colorado election audit. They have a CSV file of election results that they need to count election results for. However, the file has 369,711 rows and need some way to process the file without having to count each row one by one. The task at hand requires a python script which reads the CSV file and summarizes the election results in an effective manner.

Election Audit Results

The python script, PyPoll.py is run and provides the following summary of the election, this is done through two outputs:

  1. Output to the terminal:

    PyPoll_terminal_output

  2. Output to election_analysis.txt:

    PyPoll_txt_ouput

As indicated by both outputs, the following conclusions can be drawn:

  • 369,711 votes were cast in this congressional election
  • Each county in the precinct contributed the following votes respectively:
    • Jefferson: 10.5% (38,855)
    • Denver: 82.8% (306,055)
    • Arapahoe: 6.7% (24,801)
  • Of these, Denver county had the largest number of votes
  • Each candidate received the following number of votes respectively:
    • Charles Casper Stockham: 23.0% (85,213)
    • Diana DeGette: 73.8% (272,892)
    • Raymon Anthony Doane: 3.1% (11,606)
  • Of these, the winner was determined to be:
    • Winner: Diana DeGette
    • Winning Vote Count: 272,892
    • Winning Percentage: 73.8%

Election Audit Summary

Beyond the summarization of this election’s results, this python script can be used to summarize other elections as well by either substituting the data in election_results.csv, or by changing the script to analyze a different file instead with corresponding election result data.

Furthermore, the script can also be supplemented to analyze other voting factors as well should the data be stored in additional columns (e.g. gender in row[3], race/ethnicity in row[4], household income in row[5], etc… to row[n]). By analyzing these voting factors, politicians running in these elections may better understand the demographics of the population they are looking to represent and thus campaign effectively toward the people in these counties.

03-election-analysis-lukeperrin's People

Contributors

luperrin 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.