BW #90: Voter participation
As you've likely heard, the United States will be holding elections on Tuesday. (The best-known office is for president, but many other federal, state, and local officials are also on the ballot.) One of the biggest factors in determining who wins a US election is how many people actually go and vote. For example, it has long been assumed that young people lean left, but don't actually vote. Contrast that with retirees, who traditionally lean right, and vote in very large numbers.
Political parties thus make an effort to contact potential voters who are likely to support their candidates, and help them get to the polls to cast a ballot. In tight races – and many of the races are quite tight – the "ground game" that encourages people to vote, and even drives them to their polling places, can make a huge difference.
But even in a tight, important presidential race, with the parties trying their best to get people to vote, a huge number of Americans don't bother to do so. (Editorial aside: If you are a US citizen, please vote! Even if you live outside of the US, it might not be too late; get info from https://www.votefromabroad.org/. My family, which votes absentee in Pennsylvania from our home in Israel, sent our five absentee ballots for Harris earlier this week.)
The question of how many people vote led me to wonder whether more people vote now than in the past, whether US voting patterns are significantly different from other countries, and if there is truly a big difference between how many Americans vote in a presidential election vs. in off-year congressional elections.
Data and six questions
This week's data comes from International Institute for Democracy and Electoral Assistance, which calls itself "International IDEA" (https://www.idea.int/). International IDEA tries to help countries to become more democratic -- including monitoring and encouraging women in leadership. We have looked at their data before, back in BW 69 (https://www.bambooweekly.com/bw-69-election-participation/ ).
International IDEA's "voter turnout database" is at
https://www.idea.int/data-tools/data/voter-turnout-database
Download the data by clicking on the "export data" button next to the headline on the page. This should download an Excel file onto your computer.
To see the data dictionary for this data set, click on the "glossary" link on the right side of the page, under the headline "background information."
I have six questions and tasks for you this week. The learning goals include working with date formats, multi-indexes, plotting, sorting, and grouping.
Here are the tasks and questions; I'll be back tomorrow with my complete solutions and explanations:
- Turn the first ("All") tab of the spreadsheet into a Pandas data frame. The
Date
column should be adatetime
value. (Note: The dashes in the dates will make this tricky!) Use the "Country", "Election Type", and "Year" values for a three-level multi-index. - Turn columns whose values contain percent signs (%) and commas into float dtypes. Why can we not use an int dtype for all of these?