Python analysis of financial records, voting records, employee database.
You will be give a set of poll data called election_data.csv. The dataset is composed of three columns: Voter ID, County, and Candidate. Your task is to create a Python script that analyzes the votes and calculates each of the following:
o The total number of votes cast
o A complete list of candidates who received votes
o The percentage of votes each candidate won
o The total number of votes each candidate won
o The winner of the election based on popular vote.
In addition, your final script should both print the analysis to the terminal and export a text file with the results.
In this challenge, you get to be the boss. You oversee hundreds of employees across the country developing Tuna 2.0, a world-changing snack food based on canned tuna fish. Alas, being the boss isn’t all fun, games, and self-adulation. The company recently decided to purchase a new HR system, and unfortunately for you, the new system requires employee records be stored completely differently.
Your task is to help bridge the gap by creating a Python script able to convert your employee records to the required format. Your script will need to do the following:
employee_data.csv
file, which currently holds employee records like the below:
Emp ID,Name,DOB,SSN,State
214,Sarah Simpson,1985-12-04,282-01-8166,Florida
15,Samantha Lara,1993-09-08,848-80-7526,Colorado
411,Stacy Charles,1957-12-20,658-75-8526,Pennsylvania
Emp ID,First Name,Last Name,DOB,SSN,State
214,Sarah,Simpson,12/04/1985,***-**-8166,FL
15,Samantha,Lara,09/08/1993,***-**-7526,CO
411,Stacy,Charles,12/20/1957,***-**-8526,PA
In summary, the required conversions are as follows:
The Name
column should be split into separate First Name
and Last Name
columns.
The DOB
data should be re-written into MM/DD/YYYY
format.
The SSN
data should be re-written such that the first five numbers are hidden from view.
The State
data should be re-written as simple two-letter abbreviations.