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.
Census data are available quarterly from 2005:Q1-2018:Q1, and can be found at: https://www.census.gov/housing/hvs/data/rates.html. The code downloads raw data from the Census website, and converts the files to .csv format for ease of reading and manipulation.
The code produces two .csv files with the following columns.
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.