{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import os\n", "\n", "from helpers import (\n", " get_combined_df,\n", " save_final_df_as_jsonl,\n", " handle_slug_column_mappings,\n", " set_home_type,\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "DATA_DIR = \"../data\"\n", "PROCESSED_DIR = \"../processed/\"\n", "FACET_DIR = \"sales/\"\n", "FULL_DATA_DIR_PATH = os.path.join(DATA_DIR, FACET_DIR)\n", "FULL_PROCESSED_DIR_PATH = os.path.join(PROCESSED_DIR, FACET_DIR)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "processing Metro_mean_sale_to_list_uc_sfrcondo_sm_month.csv\n", "processing Metro_median_sale_to_list_uc_sfrcondo_week.csv\n", "processing Metro_median_sale_price_uc_sfr_week.csv\n", "processing Metro_pct_sold_below_list_uc_sfrcondo_sm_month.csv\n", "processing Metro_median_sale_price_uc_sfr_sm_sa_week.csv\n", "processing Metro_pct_sold_below_list_uc_sfrcondo_month.csv\n", "processing Metro_median_sale_price_uc_sfrcondo_sm_week.csv\n", "processing Metro_pct_sold_below_list_uc_sfrcondo_sm_week.csv\n", "processing Metro_median_sale_price_uc_sfr_month.csv\n", "processing Metro_median_sale_to_list_uc_sfrcondo_sm_month.csv\n", "processing Metro_pct_sold_above_list_uc_sfrcondo_month.csv\n", "processing Metro_median_sale_to_list_uc_sfrcondo_sm_week.csv\n", "processing Metro_median_sale_price_uc_sfrcondo_sm_sa_month.csv\n", "processing Metro_sales_count_now_uc_sfrcondo_month.csv\n", "processing Metro_pct_sold_above_list_uc_sfrcondo_week.csv\n", "processing Metro_mean_sale_to_list_uc_sfrcondo_sm_week.csv\n", "processing Metro_median_sale_price_uc_sfrcondo_sm_month.csv\n", "processing Metro_mean_sale_to_list_uc_sfrcondo_week.csv\n", "processing Metro_median_sale_price_uc_sfr_sm_month.csv\n", "processing Metro_median_sale_to_list_uc_sfrcondo_month.csv\n", "processing Metro_median_sale_price_uc_sfrcondo_sm_sa_week.csv\n", "processing Metro_pct_sold_below_list_uc_sfrcondo_week.csv\n", "processing Metro_median_sale_price_uc_sfrcondo_week.csv\n", "processing Metro_mean_sale_to_list_uc_sfrcondo_month.csv\n", "processing Metro_pct_sold_above_list_uc_sfrcondo_sm_week.csv\n", "processing Metro_median_sale_price_uc_sfr_sm_week.csv\n", "processing Metro_median_sale_price_uc_sfrcondo_month.csv\n", "processing Metro_pct_sold_above_list_uc_sfrcondo_sm_month.csv\n" ] }, { "data": { "text/html": [ "
\n", " | RegionID | \n", "SizeRank | \n", "RegionName | \n", "RegionType | \n", "StateName | \n", "Home Type | \n", "Date | \n", "Median Sale to List Ratio | \n", "Median Sale Price | \n", "Median Sale Price (Smoothed) (Seasonally Adjusted) | \n", "Median Sale Price (Smoothed) | \n", "% Sold Below List (Smoothed) | \n", "Median Sale to List Ratio (Smoothed) | \n", "% Sold Above List | \n", "Mean Sale to List Ratio (Smoothed) | \n", "Mean Sale to List Ratio | \n", "% Sold Below List | \n", "% Sold Above List (Smoothed) | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-02 | \n", "NaN | \n", "172000.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
1 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-09 | \n", "NaN | \n", "165400.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-16 | \n", "NaN | \n", "168000.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-23 | \n", "NaN | \n", "167600.0 | \n", "NaN | \n", "167600.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-03-01 | \n", "NaN | \n", "168100.0 | \n", "NaN | \n", "168100.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
255019 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-11 | \n", "0.985132 | \n", "515000.0 | \n", "480020.0 | \n", "480020.0 | \n", "0.651221 | \n", "0.982460 | \n", "0.080000 | \n", "0.978546 | \n", "0.983288 | \n", "0.680000 | \n", "0.119711 | \n", "
255020 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-18 | \n", "0.972559 | \n", "510000.0 | \n", "476901.0 | \n", "476901.0 | \n", "0.659583 | \n", "0.980362 | \n", "0.142857 | \n", "0.972912 | \n", "0.958341 | \n", "0.625000 | \n", "0.120214 | \n", "
255021 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-25 | \n", "0.979644 | \n", "484500.0 | \n", "496540.0 | \n", "496540.0 | \n", "0.669387 | \n", "0.979179 | \n", "0.088235 | \n", "0.971177 | \n", "0.973797 | \n", "0.705882 | \n", "0.107185 | \n", "
255022 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-12-02 | \n", "0.978261 | \n", "538000.0 | \n", "510491.0 | \n", "510491.0 | \n", "0.678777 | \n", "0.978899 | \n", "0.126761 | \n", "0.970576 | \n", "0.966876 | \n", "0.704225 | \n", "0.109463 | \n", "
255023 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-12-09 | \n", "0.981498 | \n", "485000.0 | \n", "503423.0 | \n", "503423.0 | \n", "0.658777 | \n", "0.977990 | \n", "0.100000 | \n", "0.970073 | \n", "0.981278 | \n", "0.600000 | \n", "0.114463 | \n", "
255024 rows × 18 columns
\n", "\n", " | Region ID | \n", "Size Rank | \n", "Region | \n", "Region Type | \n", "State | \n", "Home Type | \n", "Date | \n", "Median Sale to List Ratio | \n", "Median Sale Price | \n", "Median Sale Price (Smoothed) (Seasonally Adjusted) | \n", "Median Sale Price (Smoothed) | \n", "% Sold Below List (Smoothed) | \n", "Median Sale to List Ratio (Smoothed) | \n", "% Sold Above List | \n", "Mean Sale to List Ratio (Smoothed) | \n", "Mean Sale to List Ratio | \n", "% Sold Below List | \n", "% Sold Above List (Smoothed) | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-02 | \n", "NaN | \n", "172000.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
1 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-09 | \n", "NaN | \n", "165400.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-16 | \n", "NaN | \n", "168000.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-23 | \n", "NaN | \n", "167600.0 | \n", "NaN | \n", "167600.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-03-01 | \n", "NaN | \n", "168100.0 | \n", "NaN | \n", "168100.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
255019 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-11 | \n", "0.985132 | \n", "515000.0 | \n", "480020.0 | \n", "480020.0 | \n", "0.651221 | \n", "0.982460 | \n", "0.080000 | \n", "0.978546 | \n", "0.983288 | \n", "0.680000 | \n", "0.119711 | \n", "
255020 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-18 | \n", "0.972559 | \n", "510000.0 | \n", "476901.0 | \n", "476901.0 | \n", "0.659583 | \n", "0.980362 | \n", "0.142857 | \n", "0.972912 | \n", "0.958341 | \n", "0.625000 | \n", "0.120214 | \n", "
255021 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-25 | \n", "0.979644 | \n", "484500.0 | \n", "496540.0 | \n", "496540.0 | \n", "0.669387 | \n", "0.979179 | \n", "0.088235 | \n", "0.971177 | \n", "0.973797 | \n", "0.705882 | \n", "0.107185 | \n", "
255022 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-12-02 | \n", "0.978261 | \n", "538000.0 | \n", "510491.0 | \n", "510491.0 | \n", "0.678777 | \n", "0.978899 | \n", "0.126761 | \n", "0.970576 | \n", "0.966876 | \n", "0.704225 | \n", "0.109463 | \n", "
255023 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-12-09 | \n", "0.981498 | \n", "485000.0 | \n", "503423.0 | \n", "503423.0 | \n", "0.658777 | \n", "0.977990 | \n", "0.100000 | \n", "0.970073 | \n", "0.981278 | \n", "0.600000 | \n", "0.114463 | \n", "
255024 rows × 18 columns
\n", "\n", " | Region ID | \n", "Size Rank | \n", "Region | \n", "Region Type | \n", "State | \n", "Home Type | \n", "Date | \n", "Median Sale to List Ratio | \n", "Median Sale Price | \n", "Median Sale Price (Smoothed) (Seasonally Adjusted) | \n", "Median Sale Price (Smoothed) | \n", "% Sold Below List (Smoothed) | \n", "Median Sale to List Ratio (Smoothed) | \n", "% Sold Above List | \n", "Mean Sale to List Ratio (Smoothed) | \n", "Mean Sale to List Ratio | \n", "% Sold Below List | \n", "% Sold Above List (Smoothed) | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-02 | \n", "NaN | \n", "172000.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
1 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-09 | \n", "NaN | \n", "165400.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-16 | \n", "NaN | \n", "168000.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-02-23 | \n", "NaN | \n", "167600.0 | \n", "NaN | \n", "167600.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "102001 | \n", "0 | \n", "United States | \n", "country | \n", "NaN | \n", "SFR | \n", "2008-03-01 | \n", "NaN | \n", "168100.0 | \n", "NaN | \n", "168100.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
255019 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-11 | \n", "0.985132 | \n", "515000.0 | \n", "480020.0 | \n", "480020.0 | \n", "0.651221 | \n", "0.982460 | \n", "0.080000 | \n", "0.978546 | \n", "0.983288 | \n", "0.680000 | \n", "0.119711 | \n", "
255020 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-18 | \n", "0.972559 | \n", "510000.0 | \n", "476901.0 | \n", "476901.0 | \n", "0.659583 | \n", "0.980362 | \n", "0.142857 | \n", "0.972912 | \n", "0.958341 | \n", "0.625000 | \n", "0.120214 | \n", "
255021 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-11-25 | \n", "0.979644 | \n", "484500.0 | \n", "496540.0 | \n", "496540.0 | \n", "0.669387 | \n", "0.979179 | \n", "0.088235 | \n", "0.971177 | \n", "0.973797 | \n", "0.705882 | \n", "0.107185 | \n", "
255022 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-12-02 | \n", "0.978261 | \n", "538000.0 | \n", "510491.0 | \n", "510491.0 | \n", "0.678777 | \n", "0.978899 | \n", "0.126761 | \n", "0.970576 | \n", "0.966876 | \n", "0.704225 | \n", "0.109463 | \n", "
255023 | \n", "845160 | \n", "198 | \n", "Prescott Valley, AZ | \n", "msa | \n", "AZ | \n", "all homes | \n", "2023-12-09 | \n", "0.981498 | \n", "485000.0 | \n", "503423.0 | \n", "503423.0 | \n", "0.658777 | \n", "0.977990 | \n", "0.100000 | \n", "0.970073 | \n", "0.981278 | \n", "0.600000 | \n", "0.114463 | \n", "
255024 rows × 18 columns
\n", "