In this project, we analyze the congressional election results for some US counties. The purpose of the project is to audit the number of voters in total as well as in each county and candidate. Using Python, the election statistics are calculated, summarized, and saved on a text file.
The following represents the results of this evaluation:
- The total votes cast in this election was 369,711.
- The dataset provides the election data for three different counties, Jefferson, Denver, and Arapahoe. The number of votes and their percentages are as shown in the image below:
- According to the analysis, the county with the largest turnout was Denver.
- The following image demonstrates the number of votes and the percentage of the total votes each candidate received.
- The winner of the election is Diana DeGette. The winner’s vote count and percentage is shown below:
The analysis provided in this project, goes through the available dataset and analyzes the data in different ways. The dataset file is uploaded, read through and using the for loop and conditional statements, it assesses the data per column as well as per row. Hence, with minor updates, the script can be used for any election dataset. When changing the dataset, we need to make sure the data source as well as the column numbers (lines 5, 25, and 27) are updated according to the new dataset. In addition, the location for saving the results file should be updated accordingly.