feat: add for sale listings and update new constructions notebook
Browse files- data/for_sale_listings/Metro_invt_fs_uc_sfr_month.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfr_sm_month.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfr_sm_week.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfr_week.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_month.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_sm_month.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_sm_week.csv +0 -0
- data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_week.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfr_month.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfr_sm_month.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfr_sm_week.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfr_week.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfrcondo_month.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfrcondo_sm_month.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfrcondo_sm_week.csv +0 -0
- data/for_sale_listings/Metro_mlp_uc_sfrcondo_week.csv +0 -0
- data/for_sale_listings/Metro_new_listings_uc_sfrcondo_month.csv +0 -0
- data/for_sale_listings/Metro_new_listings_uc_sfrcondo_sm_month.csv +0 -0
- data/for_sale_listings/Metro_new_listings_uc_sfrcondo_sm_week.csv +0 -0
- data/for_sale_listings/Metro_new_listings_uc_sfrcondo_week.csv +0 -0
- data/for_sale_listings/Metro_new_pending_uc_sfrcondo_month.csv +0 -0
- data/for_sale_listings/Metro_new_pending_uc_sfrcondo_sm_month.csv +0 -0
- data/for_sale_listings/Metro_new_pending_uc_sfrcondo_sm_week.csv +0 -0
- data/for_sale_listings/Metro_new_pending_uc_sfrcondo_week.csv +0 -0
- processors/process_for_sale_listings.ipynb +770 -0
- processors/process_new_constructions.ipynb +7 -7
data/for_sale_listings/Metro_invt_fs_uc_sfr_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfr_sm_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfr_sm_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfr_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_sm_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_sm_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_invt_fs_uc_sfrcondo_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfr_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfr_sm_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfr_sm_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfr_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfrcondo_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfrcondo_sm_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfrcondo_sm_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_mlp_uc_sfrcondo_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_listings_uc_sfrcondo_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_listings_uc_sfrcondo_sm_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_listings_uc_sfrcondo_sm_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_listings_uc_sfrcondo_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_pending_uc_sfrcondo_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_pending_uc_sfrcondo_sm_month.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_pending_uc_sfrcondo_sm_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/for_sale_listings/Metro_new_pending_uc_sfrcondo_week.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
processors/process_for_sale_listings.ipynb
ADDED
@@ -0,0 +1,770 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 2,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import pandas as pd\n",
|
10 |
+
"import os"
|
11 |
+
]
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"cell_type": "code",
|
15 |
+
"execution_count": 3,
|
16 |
+
"metadata": {},
|
17 |
+
"outputs": [],
|
18 |
+
"source": [
|
19 |
+
"DATA_DIR = \"../data\"\n",
|
20 |
+
"PROCESSED_DIR = \"../processed/\"\n",
|
21 |
+
"FACET_DIR = \"for_sale_listings/\"\n",
|
22 |
+
"FULL_DATA_DIR_PATH = os.path.join(DATA_DIR, FACET_DIR)\n",
|
23 |
+
"FULL_PROCESSED_DIR_PATH = os.path.join(PROCESSED_DIR, FACET_DIR)"
|
24 |
+
]
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"cell_type": "code",
|
28 |
+
"execution_count": 7,
|
29 |
+
"metadata": {},
|
30 |
+
"outputs": [
|
31 |
+
{
|
32 |
+
"name": "stdout",
|
33 |
+
"output_type": "stream",
|
34 |
+
"text": [
|
35 |
+
"processing Metro_new_pending_uc_sfrcondo_sm_month.csv\n",
|
36 |
+
"processing Metro_invt_fs_uc_sfrcondo_week.csv\n",
|
37 |
+
"processing Metro_mlp_uc_sfrcondo_week.csv\n",
|
38 |
+
"processing Metro_invt_fs_uc_sfr_month.csv\n",
|
39 |
+
"processing Metro_mlp_uc_sfr_sm_month.csv\n",
|
40 |
+
"processing Metro_new_pending_uc_sfrcondo_month.csv\n",
|
41 |
+
"processing Metro_mlp_uc_sfrcondo_sm_week.csv\n",
|
42 |
+
"processing Metro_invt_fs_uc_sfrcondo_month.csv\n",
|
43 |
+
"processing Metro_mlp_uc_sfr_sm_week.csv\n",
|
44 |
+
"processing Metro_mlp_uc_sfrcondo_month.csv\n",
|
45 |
+
"processing Metro_new_pending_uc_sfrcondo_sm_week.csv\n",
|
46 |
+
"processing Metro_invt_fs_uc_sfr_sm_week.csv\n",
|
47 |
+
"processing Metro_invt_fs_uc_sfr_sm_month.csv\n",
|
48 |
+
"processing Metro_mlp_uc_sfr_month.csv\n",
|
49 |
+
"processing Metro_new_listings_uc_sfrcondo_week.csv\n",
|
50 |
+
"processing Metro_mlp_uc_sfrcondo_sm_month.csv\n",
|
51 |
+
"processing Metro_invt_fs_uc_sfrcondo_sm_week.csv\n",
|
52 |
+
"processing Metro_new_listings_uc_sfrcondo_sm_week.csv\n",
|
53 |
+
"processing Metro_new_listings_uc_sfrcondo_month.csv\n",
|
54 |
+
"processing Metro_new_pending_uc_sfrcondo_week.csv\n",
|
55 |
+
"processing Metro_invt_fs_uc_sfr_week.csv\n",
|
56 |
+
"processing Metro_new_listings_uc_sfrcondo_sm_month.csv\n",
|
57 |
+
"processing Metro_mlp_uc_sfr_week.csv\n",
|
58 |
+
"processing Metro_invt_fs_uc_sfrcondo_sm_month.csv\n"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"data": {
|
63 |
+
"text/html": [
|
64 |
+
"<div>\n",
|
65 |
+
"<style scoped>\n",
|
66 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
67 |
+
" vertical-align: middle;\n",
|
68 |
+
" }\n",
|
69 |
+
"\n",
|
70 |
+
" .dataframe tbody tr th {\n",
|
71 |
+
" vertical-align: top;\n",
|
72 |
+
" }\n",
|
73 |
+
"\n",
|
74 |
+
" .dataframe thead th {\n",
|
75 |
+
" text-align: right;\n",
|
76 |
+
" }\n",
|
77 |
+
"</style>\n",
|
78 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
79 |
+
" <thead>\n",
|
80 |
+
" <tr style=\"text-align: right;\">\n",
|
81 |
+
" <th></th>\n",
|
82 |
+
" <th>RegionID</th>\n",
|
83 |
+
" <th>SizeRank</th>\n",
|
84 |
+
" <th>RegionName</th>\n",
|
85 |
+
" <th>RegionType</th>\n",
|
86 |
+
" <th>StateName</th>\n",
|
87 |
+
" <th>Home Type</th>\n",
|
88 |
+
" <th>Date</th>\n",
|
89 |
+
" <th>Median Listing Price</th>\n",
|
90 |
+
" <th>Median Listing Price (Smoothed)</th>\n",
|
91 |
+
" <th>New Listings</th>\n",
|
92 |
+
" <th>New Listings (Smoothed)</th>\n",
|
93 |
+
" <th>New Pending (Smoothed)</th>\n",
|
94 |
+
" <th>New Pending</th>\n",
|
95 |
+
" </tr>\n",
|
96 |
+
" </thead>\n",
|
97 |
+
" <tbody>\n",
|
98 |
+
" <tr>\n",
|
99 |
+
" <th>0</th>\n",
|
100 |
+
" <td>102001</td>\n",
|
101 |
+
" <td>0</td>\n",
|
102 |
+
" <td>United States</td>\n",
|
103 |
+
" <td>country</td>\n",
|
104 |
+
" <td>NaN</td>\n",
|
105 |
+
" <td>all homes</td>\n",
|
106 |
+
" <td>2018-01-06</td>\n",
|
107 |
+
" <td>NaN</td>\n",
|
108 |
+
" <td>NaN</td>\n",
|
109 |
+
" <td>NaN</td>\n",
|
110 |
+
" <td>NaN</td>\n",
|
111 |
+
" <td>NaN</td>\n",
|
112 |
+
" <td>24766.0</td>\n",
|
113 |
+
" </tr>\n",
|
114 |
+
" <tr>\n",
|
115 |
+
" <th>1</th>\n",
|
116 |
+
" <td>102001</td>\n",
|
117 |
+
" <td>0</td>\n",
|
118 |
+
" <td>United States</td>\n",
|
119 |
+
" <td>country</td>\n",
|
120 |
+
" <td>NaN</td>\n",
|
121 |
+
" <td>SFR</td>\n",
|
122 |
+
" <td>2018-01-13</td>\n",
|
123 |
+
" <td>259000.0</td>\n",
|
124 |
+
" <td>NaN</td>\n",
|
125 |
+
" <td>NaN</td>\n",
|
126 |
+
" <td>NaN</td>\n",
|
127 |
+
" <td>NaN</td>\n",
|
128 |
+
" <td>NaN</td>\n",
|
129 |
+
" </tr>\n",
|
130 |
+
" <tr>\n",
|
131 |
+
" <th>2</th>\n",
|
132 |
+
" <td>102001</td>\n",
|
133 |
+
" <td>0</td>\n",
|
134 |
+
" <td>United States</td>\n",
|
135 |
+
" <td>country</td>\n",
|
136 |
+
" <td>NaN</td>\n",
|
137 |
+
" <td>all homes</td>\n",
|
138 |
+
" <td>2018-01-13</td>\n",
|
139 |
+
" <td>259900.0</td>\n",
|
140 |
+
" <td>NaN</td>\n",
|
141 |
+
" <td>71177.0</td>\n",
|
142 |
+
" <td>NaN</td>\n",
|
143 |
+
" <td>NaN</td>\n",
|
144 |
+
" <td>35229.0</td>\n",
|
145 |
+
" </tr>\n",
|
146 |
+
" <tr>\n",
|
147 |
+
" <th>3</th>\n",
|
148 |
+
" <td>102001</td>\n",
|
149 |
+
" <td>0</td>\n",
|
150 |
+
" <td>United States</td>\n",
|
151 |
+
" <td>country</td>\n",
|
152 |
+
" <td>NaN</td>\n",
|
153 |
+
" <td>SFR</td>\n",
|
154 |
+
" <td>2018-01-20</td>\n",
|
155 |
+
" <td>259900.0</td>\n",
|
156 |
+
" <td>NaN</td>\n",
|
157 |
+
" <td>NaN</td>\n",
|
158 |
+
" <td>NaN</td>\n",
|
159 |
+
" <td>NaN</td>\n",
|
160 |
+
" <td>NaN</td>\n",
|
161 |
+
" </tr>\n",
|
162 |
+
" <tr>\n",
|
163 |
+
" <th>4</th>\n",
|
164 |
+
" <td>102001</td>\n",
|
165 |
+
" <td>0</td>\n",
|
166 |
+
" <td>United States</td>\n",
|
167 |
+
" <td>country</td>\n",
|
168 |
+
" <td>NaN</td>\n",
|
169 |
+
" <td>all homes</td>\n",
|
170 |
+
" <td>2018-01-20</td>\n",
|
171 |
+
" <td>259900.0</td>\n",
|
172 |
+
" <td>NaN</td>\n",
|
173 |
+
" <td>72625.0</td>\n",
|
174 |
+
" <td>NaN</td>\n",
|
175 |
+
" <td>NaN</td>\n",
|
176 |
+
" <td>38281.0</td>\n",
|
177 |
+
" </tr>\n",
|
178 |
+
" <tr>\n",
|
179 |
+
" <th>...</th>\n",
|
180 |
+
" <td>...</td>\n",
|
181 |
+
" <td>...</td>\n",
|
182 |
+
" <td>...</td>\n",
|
183 |
+
" <td>...</td>\n",
|
184 |
+
" <td>...</td>\n",
|
185 |
+
" <td>...</td>\n",
|
186 |
+
" <td>...</td>\n",
|
187 |
+
" <td>...</td>\n",
|
188 |
+
" <td>...</td>\n",
|
189 |
+
" <td>...</td>\n",
|
190 |
+
" <td>...</td>\n",
|
191 |
+
" <td>...</td>\n",
|
192 |
+
" <td>...</td>\n",
|
193 |
+
" </tr>\n",
|
194 |
+
" <tr>\n",
|
195 |
+
" <th>2398144</th>\n",
|
196 |
+
" <td>845172</td>\n",
|
197 |
+
" <td>769</td>\n",
|
198 |
+
" <td>Winfield, KS</td>\n",
|
199 |
+
" <td>msa</td>\n",
|
200 |
+
" <td>KS</td>\n",
|
201 |
+
" <td>all homes</td>\n",
|
202 |
+
" <td>2023-12-31</td>\n",
|
203 |
+
" <td>NaN</td>\n",
|
204 |
+
" <td>136233.0</td>\n",
|
205 |
+
" <td>NaN</td>\n",
|
206 |
+
" <td>28.0</td>\n",
|
207 |
+
" <td>NaN</td>\n",
|
208 |
+
" <td>24.0</td>\n",
|
209 |
+
" </tr>\n",
|
210 |
+
" <tr>\n",
|
211 |
+
" <th>2398145</th>\n",
|
212 |
+
" <td>845172</td>\n",
|
213 |
+
" <td>769</td>\n",
|
214 |
+
" <td>Winfield, KS</td>\n",
|
215 |
+
" <td>msa</td>\n",
|
216 |
+
" <td>KS</td>\n",
|
217 |
+
" <td>SFR</td>\n",
|
218 |
+
" <td>2024-01-06</td>\n",
|
219 |
+
" <td>NaN</td>\n",
|
220 |
+
" <td>131088.0</td>\n",
|
221 |
+
" <td>NaN</td>\n",
|
222 |
+
" <td>NaN</td>\n",
|
223 |
+
" <td>NaN</td>\n",
|
224 |
+
" <td>NaN</td>\n",
|
225 |
+
" </tr>\n",
|
226 |
+
" <tr>\n",
|
227 |
+
" <th>2398146</th>\n",
|
228 |
+
" <td>845172</td>\n",
|
229 |
+
" <td>769</td>\n",
|
230 |
+
" <td>Winfield, KS</td>\n",
|
231 |
+
" <td>msa</td>\n",
|
232 |
+
" <td>KS</td>\n",
|
233 |
+
" <td>SFR</td>\n",
|
234 |
+
" <td>2024-01-06</td>\n",
|
235 |
+
" <td>135450.0</td>\n",
|
236 |
+
" <td>NaN</td>\n",
|
237 |
+
" <td>NaN</td>\n",
|
238 |
+
" <td>NaN</td>\n",
|
239 |
+
" <td>NaN</td>\n",
|
240 |
+
" <td>NaN</td>\n",
|
241 |
+
" </tr>\n",
|
242 |
+
" <tr>\n",
|
243 |
+
" <th>2398147</th>\n",
|
244 |
+
" <td>845172</td>\n",
|
245 |
+
" <td>769</td>\n",
|
246 |
+
" <td>Winfield, KS</td>\n",
|
247 |
+
" <td>msa</td>\n",
|
248 |
+
" <td>KS</td>\n",
|
249 |
+
" <td>all homes</td>\n",
|
250 |
+
" <td>2024-01-06</td>\n",
|
251 |
+
" <td>128000.0</td>\n",
|
252 |
+
" <td>NaN</td>\n",
|
253 |
+
" <td>NaN</td>\n",
|
254 |
+
" <td>NaN</td>\n",
|
255 |
+
" <td>NaN</td>\n",
|
256 |
+
" <td>NaN</td>\n",
|
257 |
+
" </tr>\n",
|
258 |
+
" <tr>\n",
|
259 |
+
" <th>2398148</th>\n",
|
260 |
+
" <td>845172</td>\n",
|
261 |
+
" <td>769</td>\n",
|
262 |
+
" <td>Winfield, KS</td>\n",
|
263 |
+
" <td>msa</td>\n",
|
264 |
+
" <td>KS</td>\n",
|
265 |
+
" <td>all homes</td>\n",
|
266 |
+
" <td>2024-01-06</td>\n",
|
267 |
+
" <td>NaN</td>\n",
|
268 |
+
" <td>121488.0</td>\n",
|
269 |
+
" <td>NaN</td>\n",
|
270 |
+
" <td>NaN</td>\n",
|
271 |
+
" <td>NaN</td>\n",
|
272 |
+
" <td>NaN</td>\n",
|
273 |
+
" </tr>\n",
|
274 |
+
" </tbody>\n",
|
275 |
+
"</table>\n",
|
276 |
+
"<p>2398149 rows × 13 columns</p>\n",
|
277 |
+
"</div>"
|
278 |
+
],
|
279 |
+
"text/plain": [
|
280 |
+
" RegionID SizeRank RegionName RegionType StateName Home Type \\\n",
|
281 |
+
"0 102001 0 United States country NaN all homes \n",
|
282 |
+
"1 102001 0 United States country NaN SFR \n",
|
283 |
+
"2 102001 0 United States country NaN all homes \n",
|
284 |
+
"3 102001 0 United States country NaN SFR \n",
|
285 |
+
"4 102001 0 United States country NaN all homes \n",
|
286 |
+
"... ... ... ... ... ... ... \n",
|
287 |
+
"2398144 845172 769 Winfield, KS msa KS all homes \n",
|
288 |
+
"2398145 845172 769 Winfield, KS msa KS SFR \n",
|
289 |
+
"2398146 845172 769 Winfield, KS msa KS SFR \n",
|
290 |
+
"2398147 845172 769 Winfield, KS msa KS all homes \n",
|
291 |
+
"2398148 845172 769 Winfield, KS msa KS all homes \n",
|
292 |
+
"\n",
|
293 |
+
" Date Median Listing Price Median Listing Price (Smoothed) \\\n",
|
294 |
+
"0 2018-01-06 NaN NaN \n",
|
295 |
+
"1 2018-01-13 259000.0 NaN \n",
|
296 |
+
"2 2018-01-13 259900.0 NaN \n",
|
297 |
+
"3 2018-01-20 259900.0 NaN \n",
|
298 |
+
"4 2018-01-20 259900.0 NaN \n",
|
299 |
+
"... ... ... ... \n",
|
300 |
+
"2398144 2023-12-31 NaN 136233.0 \n",
|
301 |
+
"2398145 2024-01-06 NaN 131088.0 \n",
|
302 |
+
"2398146 2024-01-06 135450.0 NaN \n",
|
303 |
+
"2398147 2024-01-06 128000.0 NaN \n",
|
304 |
+
"2398148 2024-01-06 NaN 121488.0 \n",
|
305 |
+
"\n",
|
306 |
+
" New Listings New Listings (Smoothed) New Pending (Smoothed) \\\n",
|
307 |
+
"0 NaN NaN NaN \n",
|
308 |
+
"1 NaN NaN NaN \n",
|
309 |
+
"2 71177.0 NaN NaN \n",
|
310 |
+
"3 NaN NaN NaN \n",
|
311 |
+
"4 72625.0 NaN NaN \n",
|
312 |
+
"... ... ... ... \n",
|
313 |
+
"2398144 NaN 28.0 NaN \n",
|
314 |
+
"2398145 NaN NaN NaN \n",
|
315 |
+
"2398146 NaN NaN NaN \n",
|
316 |
+
"2398147 NaN NaN NaN \n",
|
317 |
+
"2398148 NaN NaN NaN \n",
|
318 |
+
"\n",
|
319 |
+
" New Pending \n",
|
320 |
+
"0 24766.0 \n",
|
321 |
+
"1 NaN \n",
|
322 |
+
"2 35229.0 \n",
|
323 |
+
"3 NaN \n",
|
324 |
+
"4 38281.0 \n",
|
325 |
+
"... ... \n",
|
326 |
+
"2398144 24.0 \n",
|
327 |
+
"2398145 NaN \n",
|
328 |
+
"2398146 NaN \n",
|
329 |
+
"2398147 NaN \n",
|
330 |
+
"2398148 NaN \n",
|
331 |
+
"\n",
|
332 |
+
"[2398149 rows x 13 columns]"
|
333 |
+
]
|
334 |
+
},
|
335 |
+
"execution_count": 7,
|
336 |
+
"metadata": {},
|
337 |
+
"output_type": "execute_result"
|
338 |
+
}
|
339 |
+
],
|
340 |
+
"source": [
|
341 |
+
"# base cols RegionID,SizeRank,RegionName,RegionType,StateName\n",
|
342 |
+
"\n",
|
343 |
+
"exclude_columns = [\n",
|
344 |
+
" \"RegionID\",\n",
|
345 |
+
" \"SizeRank\",\n",
|
346 |
+
" \"RegionName\",\n",
|
347 |
+
" \"RegionType\",\n",
|
348 |
+
" \"StateName\",\n",
|
349 |
+
" \"Home Type\",\n",
|
350 |
+
"]\n",
|
351 |
+
"\n",
|
352 |
+
"batches = {\"mlp\": [], \"new_listings\": [], \"new_pending\": []}\n",
|
353 |
+
"\n",
|
354 |
+
"for filename in os.listdir(FULL_DATA_DIR_PATH):\n",
|
355 |
+
" if filename.endswith(\".csv\"):\n",
|
356 |
+
" print(\"processing \" + filename)\n",
|
357 |
+
" cur_df = pd.read_csv(os.path.join(FULL_DATA_DIR_PATH, filename))\n",
|
358 |
+
"\n",
|
359 |
+
" # ignore monthly data for now since it is redundant\n",
|
360 |
+
" if \"monthly\" in filename:\n",
|
361 |
+
" continue\n",
|
362 |
+
"\n",
|
363 |
+
" if \"sfrcondo\" in filename:\n",
|
364 |
+
" cur_df[\"Home Type\"] = \"all homes\"\n",
|
365 |
+
" elif \"sfr\" in filename:\n",
|
366 |
+
" cur_df[\"Home Type\"] = \"SFR\"\n",
|
367 |
+
" elif \"condo\" in filename:\n",
|
368 |
+
" cur_df[\"Home Type\"] = \"condo/co-op only\"\n",
|
369 |
+
"\n",
|
370 |
+
" # Identify columns to pivot\n",
|
371 |
+
" columns_to_pivot = [col for col in cur_df.columns if col not in exclude_columns]\n",
|
372 |
+
"\n",
|
373 |
+
" smoothed = \"_sm_\" in filename\n",
|
374 |
+
"\n",
|
375 |
+
" if \"_mlp_\" in filename:\n",
|
376 |
+
" cur_df = pd.melt(\n",
|
377 |
+
" cur_df,\n",
|
378 |
+
" id_vars=exclude_columns,\n",
|
379 |
+
" value_vars=columns_to_pivot,\n",
|
380 |
+
" var_name=\"Date\",\n",
|
381 |
+
" value_name=(\n",
|
382 |
+
" \"Median Listing Price\"\n",
|
383 |
+
" if not smoothed\n",
|
384 |
+
" else \"Median Listing Price (Smoothed)\"\n",
|
385 |
+
" ),\n",
|
386 |
+
" )\n",
|
387 |
+
" batches[\"mlp\"].append(cur_df)\n",
|
388 |
+
"\n",
|
389 |
+
" elif \"_new_listings_\" in filename:\n",
|
390 |
+
" cur_df = pd.melt(\n",
|
391 |
+
" cur_df,\n",
|
392 |
+
" id_vars=exclude_columns,\n",
|
393 |
+
" value_vars=columns_to_pivot,\n",
|
394 |
+
" var_name=\"Date\",\n",
|
395 |
+
" value_name=(\n",
|
396 |
+
" \"New Listings\" if not smoothed else \"New Listings (Smoothed)\"\n",
|
397 |
+
" ),\n",
|
398 |
+
" )\n",
|
399 |
+
" batches[\"new_listings\"].append(cur_df)\n",
|
400 |
+
"\n",
|
401 |
+
" elif \"new_pending\" in filename:\n",
|
402 |
+
" cur_df = pd.melt(\n",
|
403 |
+
" cur_df,\n",
|
404 |
+
" id_vars=exclude_columns,\n",
|
405 |
+
" value_vars=columns_to_pivot,\n",
|
406 |
+
" var_name=\"Date\",\n",
|
407 |
+
" value_name=\"New Pending\" if not smoothed else \"New Pending (Smoothed)\",\n",
|
408 |
+
" )\n",
|
409 |
+
" batches[\"new_pending\"].append(cur_df)\n",
|
410 |
+
"\n",
|
411 |
+
"matching_cols = [\n",
|
412 |
+
" \"RegionID\",\n",
|
413 |
+
" \"Date\",\n",
|
414 |
+
" \"SizeRank\",\n",
|
415 |
+
" \"RegionName\",\n",
|
416 |
+
" \"RegionType\",\n",
|
417 |
+
" \"StateName\",\n",
|
418 |
+
" \"Home Type\",\n",
|
419 |
+
"]\n",
|
420 |
+
"\n",
|
421 |
+
"combined_batches = [pd.concat(cur_batch) for cur_batch in batches.values()]\n",
|
422 |
+
"\n",
|
423 |
+
"if len(combined_batches) > 0:\n",
|
424 |
+
" combined_df = combined_batches[0]\n",
|
425 |
+
" for batch in combined_batches[1:]:\n",
|
426 |
+
" combined_df = pd.merge(\n",
|
427 |
+
" combined_df,\n",
|
428 |
+
" batch,\n",
|
429 |
+
" on=matching_cols,\n",
|
430 |
+
" how=\"outer\",\n",
|
431 |
+
" )\n",
|
432 |
+
"\n",
|
433 |
+
"\n",
|
434 |
+
"combined_df"
|
435 |
+
]
|
436 |
+
},
|
437 |
+
{
|
438 |
+
"cell_type": "code",
|
439 |
+
"execution_count": 6,
|
440 |
+
"metadata": {},
|
441 |
+
"outputs": [
|
442 |
+
{
|
443 |
+
"data": {
|
444 |
+
"text/html": [
|
445 |
+
"<div>\n",
|
446 |
+
"<style scoped>\n",
|
447 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
448 |
+
" vertical-align: middle;\n",
|
449 |
+
" }\n",
|
450 |
+
"\n",
|
451 |
+
" .dataframe tbody tr th {\n",
|
452 |
+
" vertical-align: top;\n",
|
453 |
+
" }\n",
|
454 |
+
"\n",
|
455 |
+
" .dataframe thead th {\n",
|
456 |
+
" text-align: right;\n",
|
457 |
+
" }\n",
|
458 |
+
"</style>\n",
|
459 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
460 |
+
" <thead>\n",
|
461 |
+
" <tr style=\"text-align: right;\">\n",
|
462 |
+
" <th></th>\n",
|
463 |
+
" <th>Region ID</th>\n",
|
464 |
+
" <th>Size Rank</th>\n",
|
465 |
+
" <th>Region</th>\n",
|
466 |
+
" <th>Region Type</th>\n",
|
467 |
+
" <th>State</th>\n",
|
468 |
+
" <th>Home Type</th>\n",
|
469 |
+
" <th>Date</th>\n",
|
470 |
+
" <th>Median Listing Price</th>\n",
|
471 |
+
" <th>Median Listing Price (Smoothed)</th>\n",
|
472 |
+
" <th>New Listings</th>\n",
|
473 |
+
" <th>New Listings (Smoothed)</th>\n",
|
474 |
+
" <th>New Pending (Smoothed)</th>\n",
|
475 |
+
" <th>New Pending</th>\n",
|
476 |
+
" </tr>\n",
|
477 |
+
" </thead>\n",
|
478 |
+
" <tbody>\n",
|
479 |
+
" <tr>\n",
|
480 |
+
" <th>0</th>\n",
|
481 |
+
" <td>102001</td>\n",
|
482 |
+
" <td>0</td>\n",
|
483 |
+
" <td>United States</td>\n",
|
484 |
+
" <td>country</td>\n",
|
485 |
+
" <td>NaN</td>\n",
|
486 |
+
" <td>all homes</td>\n",
|
487 |
+
" <td>2018-01-06</td>\n",
|
488 |
+
" <td>NaN</td>\n",
|
489 |
+
" <td>NaN</td>\n",
|
490 |
+
" <td>NaN</td>\n",
|
491 |
+
" <td>NaN</td>\n",
|
492 |
+
" <td>NaN</td>\n",
|
493 |
+
" <td>24766.0</td>\n",
|
494 |
+
" </tr>\n",
|
495 |
+
" <tr>\n",
|
496 |
+
" <th>1</th>\n",
|
497 |
+
" <td>102001</td>\n",
|
498 |
+
" <td>0</td>\n",
|
499 |
+
" <td>United States</td>\n",
|
500 |
+
" <td>country</td>\n",
|
501 |
+
" <td>NaN</td>\n",
|
502 |
+
" <td>SFR</td>\n",
|
503 |
+
" <td>2018-01-13</td>\n",
|
504 |
+
" <td>259000.0</td>\n",
|
505 |
+
" <td>NaN</td>\n",
|
506 |
+
" <td>NaN</td>\n",
|
507 |
+
" <td>NaN</td>\n",
|
508 |
+
" <td>NaN</td>\n",
|
509 |
+
" <td>NaN</td>\n",
|
510 |
+
" </tr>\n",
|
511 |
+
" <tr>\n",
|
512 |
+
" <th>2</th>\n",
|
513 |
+
" <td>102001</td>\n",
|
514 |
+
" <td>0</td>\n",
|
515 |
+
" <td>United States</td>\n",
|
516 |
+
" <td>country</td>\n",
|
517 |
+
" <td>NaN</td>\n",
|
518 |
+
" <td>all homes</td>\n",
|
519 |
+
" <td>2018-01-13</td>\n",
|
520 |
+
" <td>259900.0</td>\n",
|
521 |
+
" <td>NaN</td>\n",
|
522 |
+
" <td>71177.0</td>\n",
|
523 |
+
" <td>NaN</td>\n",
|
524 |
+
" <td>NaN</td>\n",
|
525 |
+
" <td>35229.0</td>\n",
|
526 |
+
" </tr>\n",
|
527 |
+
" <tr>\n",
|
528 |
+
" <th>3</th>\n",
|
529 |
+
" <td>102001</td>\n",
|
530 |
+
" <td>0</td>\n",
|
531 |
+
" <td>United States</td>\n",
|
532 |
+
" <td>country</td>\n",
|
533 |
+
" <td>NaN</td>\n",
|
534 |
+
" <td>SFR</td>\n",
|
535 |
+
" <td>2018-01-20</td>\n",
|
536 |
+
" <td>259900.0</td>\n",
|
537 |
+
" <td>NaN</td>\n",
|
538 |
+
" <td>NaN</td>\n",
|
539 |
+
" <td>NaN</td>\n",
|
540 |
+
" <td>NaN</td>\n",
|
541 |
+
" <td>NaN</td>\n",
|
542 |
+
" </tr>\n",
|
543 |
+
" <tr>\n",
|
544 |
+
" <th>4</th>\n",
|
545 |
+
" <td>102001</td>\n",
|
546 |
+
" <td>0</td>\n",
|
547 |
+
" <td>United States</td>\n",
|
548 |
+
" <td>country</td>\n",
|
549 |
+
" <td>NaN</td>\n",
|
550 |
+
" <td>all homes</td>\n",
|
551 |
+
" <td>2018-01-20</td>\n",
|
552 |
+
" <td>259900.0</td>\n",
|
553 |
+
" <td>NaN</td>\n",
|
554 |
+
" <td>72625.0</td>\n",
|
555 |
+
" <td>NaN</td>\n",
|
556 |
+
" <td>NaN</td>\n",
|
557 |
+
" <td>38281.0</td>\n",
|
558 |
+
" </tr>\n",
|
559 |
+
" <tr>\n",
|
560 |
+
" <th>...</th>\n",
|
561 |
+
" <td>...</td>\n",
|
562 |
+
" <td>...</td>\n",
|
563 |
+
" <td>...</td>\n",
|
564 |
+
" <td>...</td>\n",
|
565 |
+
" <td>...</td>\n",
|
566 |
+
" <td>...</td>\n",
|
567 |
+
" <td>...</td>\n",
|
568 |
+
" <td>...</td>\n",
|
569 |
+
" <td>...</td>\n",
|
570 |
+
" <td>...</td>\n",
|
571 |
+
" <td>...</td>\n",
|
572 |
+
" <td>...</td>\n",
|
573 |
+
" <td>...</td>\n",
|
574 |
+
" </tr>\n",
|
575 |
+
" <tr>\n",
|
576 |
+
" <th>2398144</th>\n",
|
577 |
+
" <td>845172</td>\n",
|
578 |
+
" <td>769</td>\n",
|
579 |
+
" <td>Winfield, KS</td>\n",
|
580 |
+
" <td>msa</td>\n",
|
581 |
+
" <td>KS</td>\n",
|
582 |
+
" <td>all homes</td>\n",
|
583 |
+
" <td>2023-12-31</td>\n",
|
584 |
+
" <td>NaN</td>\n",
|
585 |
+
" <td>136233.0</td>\n",
|
586 |
+
" <td>NaN</td>\n",
|
587 |
+
" <td>28.0</td>\n",
|
588 |
+
" <td>NaN</td>\n",
|
589 |
+
" <td>24.0</td>\n",
|
590 |
+
" </tr>\n",
|
591 |
+
" <tr>\n",
|
592 |
+
" <th>2398145</th>\n",
|
593 |
+
" <td>845172</td>\n",
|
594 |
+
" <td>769</td>\n",
|
595 |
+
" <td>Winfield, KS</td>\n",
|
596 |
+
" <td>msa</td>\n",
|
597 |
+
" <td>KS</td>\n",
|
598 |
+
" <td>SFR</td>\n",
|
599 |
+
" <td>2024-01-06</td>\n",
|
600 |
+
" <td>NaN</td>\n",
|
601 |
+
" <td>131088.0</td>\n",
|
602 |
+
" <td>NaN</td>\n",
|
603 |
+
" <td>NaN</td>\n",
|
604 |
+
" <td>NaN</td>\n",
|
605 |
+
" <td>NaN</td>\n",
|
606 |
+
" </tr>\n",
|
607 |
+
" <tr>\n",
|
608 |
+
" <th>2398146</th>\n",
|
609 |
+
" <td>845172</td>\n",
|
610 |
+
" <td>769</td>\n",
|
611 |
+
" <td>Winfield, KS</td>\n",
|
612 |
+
" <td>msa</td>\n",
|
613 |
+
" <td>KS</td>\n",
|
614 |
+
" <td>SFR</td>\n",
|
615 |
+
" <td>2024-01-06</td>\n",
|
616 |
+
" <td>135450.0</td>\n",
|
617 |
+
" <td>NaN</td>\n",
|
618 |
+
" <td>NaN</td>\n",
|
619 |
+
" <td>NaN</td>\n",
|
620 |
+
" <td>NaN</td>\n",
|
621 |
+
" <td>NaN</td>\n",
|
622 |
+
" </tr>\n",
|
623 |
+
" <tr>\n",
|
624 |
+
" <th>2398147</th>\n",
|
625 |
+
" <td>845172</td>\n",
|
626 |
+
" <td>769</td>\n",
|
627 |
+
" <td>Winfield, KS</td>\n",
|
628 |
+
" <td>msa</td>\n",
|
629 |
+
" <td>KS</td>\n",
|
630 |
+
" <td>all homes</td>\n",
|
631 |
+
" <td>2024-01-06</td>\n",
|
632 |
+
" <td>128000.0</td>\n",
|
633 |
+
" <td>NaN</td>\n",
|
634 |
+
" <td>NaN</td>\n",
|
635 |
+
" <td>NaN</td>\n",
|
636 |
+
" <td>NaN</td>\n",
|
637 |
+
" <td>NaN</td>\n",
|
638 |
+
" </tr>\n",
|
639 |
+
" <tr>\n",
|
640 |
+
" <th>2398148</th>\n",
|
641 |
+
" <td>845172</td>\n",
|
642 |
+
" <td>769</td>\n",
|
643 |
+
" <td>Winfield, KS</td>\n",
|
644 |
+
" <td>msa</td>\n",
|
645 |
+
" <td>KS</td>\n",
|
646 |
+
" <td>all homes</td>\n",
|
647 |
+
" <td>2024-01-06</td>\n",
|
648 |
+
" <td>NaN</td>\n",
|
649 |
+
" <td>121488.0</td>\n",
|
650 |
+
" <td>NaN</td>\n",
|
651 |
+
" <td>NaN</td>\n",
|
652 |
+
" <td>NaN</td>\n",
|
653 |
+
" <td>NaN</td>\n",
|
654 |
+
" </tr>\n",
|
655 |
+
" </tbody>\n",
|
656 |
+
"</table>\n",
|
657 |
+
"<p>2398149 rows × 13 columns</p>\n",
|
658 |
+
"</div>"
|
659 |
+
],
|
660 |
+
"text/plain": [
|
661 |
+
" Region ID Size Rank Region Region Type State Home Type \\\n",
|
662 |
+
"0 102001 0 United States country NaN all homes \n",
|
663 |
+
"1 102001 0 United States country NaN SFR \n",
|
664 |
+
"2 102001 0 United States country NaN all homes \n",
|
665 |
+
"3 102001 0 United States country NaN SFR \n",
|
666 |
+
"4 102001 0 United States country NaN all homes \n",
|
667 |
+
"... ... ... ... ... ... ... \n",
|
668 |
+
"2398144 845172 769 Winfield, KS msa KS all homes \n",
|
669 |
+
"2398145 845172 769 Winfield, KS msa KS SFR \n",
|
670 |
+
"2398146 845172 769 Winfield, KS msa KS SFR \n",
|
671 |
+
"2398147 845172 769 Winfield, KS msa KS all homes \n",
|
672 |
+
"2398148 845172 769 Winfield, KS msa KS all homes \n",
|
673 |
+
"\n",
|
674 |
+
" Date Median Listing Price Median Listing Price (Smoothed) \\\n",
|
675 |
+
"0 2018-01-06 NaN NaN \n",
|
676 |
+
"1 2018-01-13 259000.0 NaN \n",
|
677 |
+
"2 2018-01-13 259900.0 NaN \n",
|
678 |
+
"3 2018-01-20 259900.0 NaN \n",
|
679 |
+
"4 2018-01-20 259900.0 NaN \n",
|
680 |
+
"... ... ... ... \n",
|
681 |
+
"2398144 2023-12-31 NaN 136233.0 \n",
|
682 |
+
"2398145 2024-01-06 NaN 131088.0 \n",
|
683 |
+
"2398146 2024-01-06 135450.0 NaN \n",
|
684 |
+
"2398147 2024-01-06 128000.0 NaN \n",
|
685 |
+
"2398148 2024-01-06 NaN 121488.0 \n",
|
686 |
+
"\n",
|
687 |
+
" New Listings New Listings (Smoothed) New Pending (Smoothed) \\\n",
|
688 |
+
"0 NaN NaN NaN \n",
|
689 |
+
"1 NaN NaN NaN \n",
|
690 |
+
"2 71177.0 NaN NaN \n",
|
691 |
+
"3 NaN NaN NaN \n",
|
692 |
+
"4 72625.0 NaN NaN \n",
|
693 |
+
"... ... ... ... \n",
|
694 |
+
"2398144 NaN 28.0 NaN \n",
|
695 |
+
"2398145 NaN NaN NaN \n",
|
696 |
+
"2398146 NaN NaN NaN \n",
|
697 |
+
"2398147 NaN NaN NaN \n",
|
698 |
+
"2398148 NaN NaN NaN \n",
|
699 |
+
"\n",
|
700 |
+
" New Pending \n",
|
701 |
+
"0 24766.0 \n",
|
702 |
+
"1 NaN \n",
|
703 |
+
"2 35229.0 \n",
|
704 |
+
"3 NaN \n",
|
705 |
+
"4 38281.0 \n",
|
706 |
+
"... ... \n",
|
707 |
+
"2398144 24.0 \n",
|
708 |
+
"2398145 NaN \n",
|
709 |
+
"2398146 NaN \n",
|
710 |
+
"2398147 NaN \n",
|
711 |
+
"2398148 NaN \n",
|
712 |
+
"\n",
|
713 |
+
"[2398149 rows x 13 columns]"
|
714 |
+
]
|
715 |
+
},
|
716 |
+
"execution_count": 6,
|
717 |
+
"metadata": {},
|
718 |
+
"output_type": "execute_result"
|
719 |
+
}
|
720 |
+
],
|
721 |
+
"source": [
|
722 |
+
"final_df = combined_df\n",
|
723 |
+
"final_df = final_df.rename(\n",
|
724 |
+
" columns={\n",
|
725 |
+
" \"RegionID\": \"Region ID\",\n",
|
726 |
+
" \"SizeRank\": \"Size Rank\",\n",
|
727 |
+
" \"RegionName\": \"Region\",\n",
|
728 |
+
" \"RegionType\": \"Region Type\",\n",
|
729 |
+
" \"StateName\": \"State\",\n",
|
730 |
+
" }\n",
|
731 |
+
")\n",
|
732 |
+
"\n",
|
733 |
+
"final_df"
|
734 |
+
]
|
735 |
+
},
|
736 |
+
{
|
737 |
+
"cell_type": "code",
|
738 |
+
"execution_count": 49,
|
739 |
+
"metadata": {},
|
740 |
+
"outputs": [],
|
741 |
+
"source": [
|
742 |
+
"if not os.path.exists(FULL_PROCESSED_DIR_PATH):\n",
|
743 |
+
" os.makedirs(FULL_PROCESSED_DIR_PATH)\n",
|
744 |
+
"\n",
|
745 |
+
"final_df.to_json(FULL_PROCESSED_DIR_PATH + \"final.jsonl\", orient=\"records\", lines=True)"
|
746 |
+
]
|
747 |
+
}
|
748 |
+
],
|
749 |
+
"metadata": {
|
750 |
+
"kernelspec": {
|
751 |
+
"display_name": "Python 3",
|
752 |
+
"language": "python",
|
753 |
+
"name": "python3"
|
754 |
+
},
|
755 |
+
"language_info": {
|
756 |
+
"codemirror_mode": {
|
757 |
+
"name": "ipython",
|
758 |
+
"version": 3
|
759 |
+
},
|
760 |
+
"file_extension": ".py",
|
761 |
+
"mimetype": "text/x-python",
|
762 |
+
"name": "python",
|
763 |
+
"nbconvert_exporter": "python",
|
764 |
+
"pygments_lexer": "ipython3",
|
765 |
+
"version": "3.12.2"
|
766 |
+
}
|
767 |
+
},
|
768 |
+
"nbformat": 4,
|
769 |
+
"nbformat_minor": 2
|
770 |
+
}
|
processors/process_new_constructions.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
@@ -12,7 +12,7 @@
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
-
"execution_count":
|
16 |
"metadata": {},
|
17 |
"outputs": [],
|
18 |
"source": [
|
@@ -25,7 +25,7 @@
|
|
25 |
},
|
26 |
{
|
27 |
"cell_type": "code",
|
28 |
-
"execution_count":
|
29 |
"metadata": {},
|
30 |
"outputs": [
|
31 |
{
|
@@ -268,7 +268,7 @@
|
|
268 |
"[49487 rows x 10 columns]"
|
269 |
]
|
270 |
},
|
271 |
-
"execution_count":
|
272 |
"metadata": {},
|
273 |
"output_type": "execute_result"
|
274 |
}
|
@@ -360,7 +360,7 @@
|
|
360 |
},
|
361 |
{
|
362 |
"cell_type": "code",
|
363 |
-
"execution_count":
|
364 |
"metadata": {},
|
365 |
"outputs": [
|
366 |
{
|
@@ -588,7 +588,7 @@
|
|
588 |
"[49487 rows x 10 columns]"
|
589 |
]
|
590 |
},
|
591 |
-
"execution_count":
|
592 |
"metadata": {},
|
593 |
"output_type": "execute_result"
|
594 |
}
|
@@ -610,7 +610,7 @@
|
|
610 |
},
|
611 |
{
|
612 |
"cell_type": "code",
|
613 |
-
"execution_count":
|
614 |
"metadata": {},
|
615 |
"outputs": [],
|
616 |
"source": [
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 59,
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
+
"execution_count": 60,
|
16 |
"metadata": {},
|
17 |
"outputs": [],
|
18 |
"source": [
|
|
|
25 |
},
|
26 |
{
|
27 |
"cell_type": "code",
|
28 |
+
"execution_count": 61,
|
29 |
"metadata": {},
|
30 |
"outputs": [
|
31 |
{
|
|
|
268 |
"[49487 rows x 10 columns]"
|
269 |
]
|
270 |
},
|
271 |
+
"execution_count": 61,
|
272 |
"metadata": {},
|
273 |
"output_type": "execute_result"
|
274 |
}
|
|
|
360 |
},
|
361 |
{
|
362 |
"cell_type": "code",
|
363 |
+
"execution_count": 62,
|
364 |
"metadata": {},
|
365 |
"outputs": [
|
366 |
{
|
|
|
588 |
"[49487 rows x 10 columns]"
|
589 |
]
|
590 |
},
|
591 |
+
"execution_count": 62,
|
592 |
"metadata": {},
|
593 |
"output_type": "execute_result"
|
594 |
}
|
|
|
610 |
},
|
611 |
{
|
612 |
"cell_type": "code",
|
613 |
+
"execution_count": 63,
|
614 |
"metadata": {},
|
615 |
"outputs": [],
|
616 |
"source": [
|