Skip to content

cmwardcode/Election_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Election_Analysis

PyPoll with Python

Skill Development

Read and extract CVS files; differentiation of python data types - integers, floating-point decimal numbers, strings; perform mathematical operations using data types; declare variables using different data types; create and use data structures like lists, tuples, and dictionaries; create and use decision and repetition statements; create and use Boolean and logical operators; write data to an output file and print the file; create scripts that read, write, and store data from files or in arrays; use decision statements, logical operations for complex comparisons, and repetition statements to run code more than once; produce screen outputs; code refactoring

Overview of Election Audit

Assiating a Board of Elections employee with completing an election audit of a recent local congressional election. Purpose of audit was to determine winning candidate and largest voter turnouts based on county. Deliverable 1: The election results printed to the Command Line, Deliverable 2: The election results saved to a text file, Deliverable 3: A written analysis of the election audit (README)

  1. Calculate the total number of votes cast.
  2. Complete list of counties that had a turnout.
  3. Calculate the voter turnout for each county.
  4. Calculate the percentage of votes each county cast.
  5. Identify the county with the highest turnout.
  6. Complete list of candidates who recieved votes.
  7. Calculate the total number of votes each candidate recieved.
  8. Calculate the percentage of votes each candidate won.
  9. Determine the winner of the election based on popular vote.

Election Outcomes

Total Votes: 369,711

Voter turnout for each county and percentage compared to total vote:

  • Jefferson: 38,855 – 10.5%
  • Denver: 306,055 – 82.8% (Largest number of votes)
  • Arapahoe: 24,801 – 6.7%

Candidate Results:

  • Charles Casper Stockham: 23.0% (85,213)
  • Diana DeGette: 73.8% (272,892) – Winner
  • Raymon Anthony Doane: 3.1% (11,606)

Purposed Modifications for Reapplication

  1. The code can be applied year after year to calculate the result breakdown but it can be refactored to analyze more data by shifting the columns variables that is looking for to use in the calculations.
  2. The script can be used as a template to analyze election data on a larger scale from more than just counties through a modification of ingesting multiple files and creating a combined database.

About

Python data analysis election audit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages