Exercise

High Rent and Rent Burden

Rents can be very high in places like San Francisco, but to understand the geography of rent burden, looking at gross rents may not be as useful as looking at the share of income spent on rent.

In this exercise, you will join a DataFrame with gross rents in dollars (median_rent) and as a percentage of income (median_rent_pct_of_income) by Census tract in San Francisco with a geopandas DataFrame of those tracts. You will then map and compare these two variables. Darker colors in the maps indicate higher values (higher rents, or higher rent share of income).

The first few rows of these two columns are displayed in the console.

pandas and geopandas are imported using the usual aliases.

Instructions

100 XP
  • merge sf_rent with the sf_tracts geopandas DataFrame, matching on the state, county and tract columns.
  • To map median_rent in San Francisco, use the notnull() method on the median_rent column to exclude a tract with missing data.
  • Map the median_rent_pct_of_income column. Use the arrows in the plotting window to compare this map with the map of median_rent.
  • Print the Pearson correlation between median_rent and median_rent_pct_of_income.