Median home price to income ratio

Question

You're given the following datasets, one containing median income across 20 cities in the US and another containing median house sale prices. Calculate the median house sales price to income ratio between 2012 and 2019 for the cities listed in the median income dataset and plot the data in a line chart.

To help get you started, below is code (Python) to import the referenced dataset:

# Import libraries
%matplotlib inline
import pandas as pd
import numpy as np
# Import data
df_income = pd.read_csv('https://raw.githubusercontent.com/erood/interviewqs.com_code_snippets/master/Datasets/median_income.csv')
df_house = pd.read_csv('https://raw.githubusercontent.com/erood/interviewqs.com_code_snippets/master/Datasets/zillow_median_sales_price.csv')

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now