Homework 2
Instructions
Your solutions should be in form of a report in .md
format. Make sure to document you procedure properly. In the beginning of the assignment, you will be working with Git & Github, for this part, you do not have to document what you have done but we will check if it has been done. When you are finished push you results to Github and raise an issue, just as you have done in previous homework. To pass the homework you will have to complete the assigments below and also finish the peer-review.
Feel free to contact me if anything is unclear.
Setting up the repo
From homework 1 you should already have your repository set up. To begin with, create a .gitignore
file in the root of you repository. Make sure that you ignore files that are unnecessary to the homework. Now, create a new branch, name it something along the lines of homework_2
or hw2
. Remember to use _
instead of spaces between words. All new changes, should be made in this branch.
After you are finished with the homework, merge the new branch to the main branch. We will only evaluate the main branch. We will also check to see that you have created a branch, this is part of the assignment.
Working with tables
The data for the assigments below can be found in the following repository on the Github organization.
Apartment Prices
The data found in Booli_sold.csv
contains data on sales of apartments in Ekhagen (next to Lappis). Download this file and read it into your code. Note that the data file is of type .csv
. If you run in to some issue whilst reading in the data, use Google!
Your task is to
- Calculate the price per square meter (ppsqm) for each apartment sold. That is, add a new variable to your table containing the data representing the ppsqm.
- Rank the top 5 most expensive appartments w.r.t ppsqm? Present this in a table. Hint: Use a sort function.
- What is the avereage ppsqm in Ekhagen?
- Highlight an aspect of the data that you find interesting. Explain you choice.
The Swedish Election of 2018
The data found in 2018_R_per_kommun.csv
contains data on voting in the 2018 Swedish election. Your job is to analyize the data by completeing the tasks below.
Note that csv files can have different seperators, delimeters and decimal signs. Take this into account when you are reading in this dataset. Your
Your task is to
- Calculate the total number of legitimate votes (Giltiga Röster) in Stockholm during the election. That is, sum upp the number of legitimate votes for all municipalities (kommun) in Stockholm.
- In which municipality did the social democratic party (Social demokraterna, S) garner the hightest voting percentage?
- Rank the (3) municipialities with highest participation (valdeltagande). Present this in the form of a table.