Below is a code challenge designed to help you practice a variety of skills:
- Download remote data
- Write data to a text file to local disk
- Read and write CSV files
- Generate summary data using
dicts
Yes, you could use the
pandas
library to arguably simplify these tasks, but the point is to get some reps using these more basic Python tools and workflows.
Write code to :
- Download this fake election data using this election CSV link
- Save the code to a local file called
election_data
- Read the data using the
csv
library - Use dictionaries to tally the following stats:
- Total votes by candidate
- Total votes by party
- Use the
csv
module to write two new spreadsheets: candidate_totals.csv
- containsname
andvote_total
fieldsparty_totals.csv
- containsparty
andvote_total
fields