Skip to content
Clean data on homeownership and rental vacancies for metropolitan areas.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Clean Census MSA-level Homeownership and Vacancy Rate Data

This file cleans Homeownership Rate, Rental Vacancy Rate, and Homeowner Vacancy data by MSA from the Census Housing Vacancies and Homeownership (CPS/HVS) statistics. The raw text files are not easy to manipulate, and are in an unusable format for MSA-by-MSA time series analysis. This code cleans and formats, leaving the data in long-form for ease of use as panel data. Note that the code can be modified to clean the state-level or national data for the same variables. Both of these are also available at the Census website.

Comments and suggestions most welcome.

Getting Started

Census data are available quarterly from 2005:Q1-2018:Q1, and can be found at: The code downloads raw data from the Census website, and converts the files to .csv format for ease of reading and manipulation.

Code output

The code produces two .csv files with the following columns.

  • MSA_Name
  • Year
  • Quarter
  • HomeOwnershipRate/RentalVacancyRate/HomeownerVacancyRate

The resulting .csv files are approximately 166kb in size.


The script requires 'Python' along with the 'numpy', 'pandas', and 'requests' libraries.

Running the code

The code can be run directly from the command line via:



  • James Graham (NYU, 2018)


This project is licensed under the MIT License.

You can’t perform that action at this time.