feat: simplify new constructions processing
Browse files- processed/new_constructions/final.jsonl +2 -2
- processors/process_new_constructions.ipynb +92 -88
- zillow.py +11 -7
processed/new_constructions/final.jsonl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e0a487f1b425d392a62c6dd88655fe958c42a937d901efdd5dbc2ebf055826f3
|
3 |
+
size 10854928
|
processors/process_new_constructions.ipynb
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
},
|
26 |
{
|
27 |
"cell_type": "code",
|
28 |
-
"execution_count":
|
29 |
"metadata": {},
|
30 |
"outputs": [
|
31 |
{
|
@@ -71,9 +71,9 @@
|
|
71 |
" <th>StateName</th>\n",
|
72 |
" <th>Home Type</th>\n",
|
73 |
" <th>Date</th>\n",
|
74 |
-
" <th>Sale Price</th>\n",
|
75 |
-
" <th>Sale Price
|
76 |
-
" <th>Count</th>\n",
|
77 |
" </tr>\n",
|
78 |
" </thead>\n",
|
79 |
" <tbody>\n",
|
@@ -86,8 +86,8 @@
|
|
86 |
" <td>NaN</td>\n",
|
87 |
" <td>SFR</td>\n",
|
88 |
" <td>2018-01-31</td>\n",
|
89 |
-
" <td>309000.0</td>\n",
|
90 |
" <td>137.412316</td>\n",
|
|
|
91 |
" <td>33940.0</td>\n",
|
92 |
" </tr>\n",
|
93 |
" <tr>\n",
|
@@ -99,8 +99,8 @@
|
|
99 |
" <td>NaN</td>\n",
|
100 |
" <td>all homes</td>\n",
|
101 |
" <td>2018-01-31</td>\n",
|
102 |
-
" <td>314596.0</td>\n",
|
103 |
" <td>140.504620</td>\n",
|
|
|
104 |
" <td>37135.0</td>\n",
|
105 |
" </tr>\n",
|
106 |
" <tr>\n",
|
@@ -112,8 +112,8 @@
|
|
112 |
" <td>NaN</td>\n",
|
113 |
" <td>condo/co-op only</td>\n",
|
114 |
" <td>2018-01-31</td>\n",
|
115 |
-
" <td>388250.0</td>\n",
|
116 |
" <td>238.300000</td>\n",
|
|
|
117 |
" <td>3195.0</td>\n",
|
118 |
" </tr>\n",
|
119 |
" <tr>\n",
|
@@ -125,8 +125,8 @@
|
|
125 |
" <td>NaN</td>\n",
|
126 |
" <td>SFR</td>\n",
|
127 |
" <td>2018-02-28</td>\n",
|
128 |
-
" <td>309072.5</td>\n",
|
129 |
" <td>137.199170</td>\n",
|
|
|
130 |
" <td>33304.0</td>\n",
|
131 |
" </tr>\n",
|
132 |
" <tr>\n",
|
@@ -138,8 +138,8 @@
|
|
138 |
" <td>NaN</td>\n",
|
139 |
" <td>all homes</td>\n",
|
140 |
" <td>2018-02-28</td>\n",
|
141 |
-
" <td>314608.0</td>\n",
|
142 |
" <td>140.304966</td>\n",
|
|
|
143 |
" <td>36493.0</td>\n",
|
144 |
" </tr>\n",
|
145 |
" <tr>\n",
|
@@ -239,30 +239,41 @@
|
|
239 |
"49485 845162 535 Granbury, TX msa TX \n",
|
240 |
"49486 845162 535 Granbury, TX msa TX \n",
|
241 |
"\n",
|
242 |
-
" Home Type Date
|
243 |
-
"0 SFR 2018-01-31
|
244 |
-
"1 all homes 2018-01-31
|
245 |
-
"2 condo/co-op only 2018-01-31
|
246 |
-
"3 SFR 2018-02-28
|
247 |
-
"4 all homes 2018-02-28
|
248 |
-
"... ... ...
|
249 |
-
"49482 all homes 2023-09-30
|
250 |
-
"49483 SFR 2023-10-31
|
251 |
-
"49484 all homes 2023-10-31
|
252 |
-
"49485 SFR 2023-11-30
|
253 |
-
"49486 all homes 2023-11-30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
"\n",
|
255 |
"[49487 rows x 10 columns]"
|
256 |
]
|
257 |
},
|
258 |
-
"execution_count":
|
259 |
"metadata": {},
|
260 |
"output_type": "execute_result"
|
261 |
}
|
262 |
],
|
263 |
"source": [
|
264 |
-
"data_frames = []\n",
|
265 |
-
"\n",
|
266 |
"# base cols RegionID,SizeRank,RegionName,RegionType,StateName\n",
|
267 |
"\n",
|
268 |
"exclude_columns = [\n",
|
@@ -271,13 +282,10 @@
|
|
271 |
" \"RegionName\",\n",
|
272 |
" \"RegionType\",\n",
|
273 |
" \"StateName\",\n",
|
274 |
-
" # \"Value Type\",\n",
|
275 |
" \"Home Type\",\n",
|
276 |
"]\n",
|
277 |
"\n",
|
278 |
-
"
|
279 |
-
"price_per_sqft_data_frames = []\n",
|
280 |
-
"count_data_frames = []\n",
|
281 |
"\n",
|
282 |
"for filename in os.listdir(FULL_DATA_DIR_PATH):\n",
|
283 |
" if filename.endswith(\".csv\"):\n",
|
@@ -294,45 +302,37 @@
|
|
294 |
" # Identify columns to pivot\n",
|
295 |
" columns_to_pivot = [col for col in cur_df.columns if col not in exclude_columns]\n",
|
296 |
"\n",
|
297 |
-
" if \"
|
298 |
-
" # cur_df[\"Value Type\"] = \"Sale Price Per Sqft\"\n",
|
299 |
-
" # Perform pivot\n",
|
300 |
" cur_df = pd.melt(\n",
|
301 |
" cur_df,\n",
|
302 |
" id_vars=exclude_columns,\n",
|
303 |
" value_vars=columns_to_pivot,\n",
|
304 |
" var_name=\"Date\",\n",
|
305 |
-
" value_name=\"Sale Price per Sqft\",\n",
|
306 |
" )\n",
|
307 |
-
"
|
308 |
"\n",
|
309 |
-
" elif \"
|
310 |
-
" # cur_df[\"Value Type\"] = \"Sale Price\"\n",
|
311 |
" cur_df = pd.melt(\n",
|
312 |
" cur_df,\n",
|
313 |
" id_vars=exclude_columns,\n",
|
314 |
" value_vars=columns_to_pivot,\n",
|
315 |
" var_name=\"Date\",\n",
|
316 |
-
" value_name=\"Sale Price\",\n",
|
317 |
" )\n",
|
318 |
-
"
|
319 |
"\n",
|
320 |
-
" elif \"
|
321 |
-
" # cur_df[\"Value Type\"] = \"Count\"\n",
|
322 |
" cur_df = pd.melt(\n",
|
323 |
" cur_df,\n",
|
324 |
" id_vars=exclude_columns,\n",
|
325 |
" value_vars=columns_to_pivot,\n",
|
326 |
" var_name=\"Date\",\n",
|
327 |
-
" value_name=\"Count\",\n",
|
328 |
" )\n",
|
329 |
-
"
|
330 |
"\n",
|
331 |
"\n",
|
332 |
-
"combined_price = pd.concat(price_data_frames)\n",
|
333 |
-
"combined_price_per = pd.concat(price_per_sqft_data_frames)\n",
|
334 |
-
"combined_count = pd.concat(count_data_frames)\n",
|
335 |
-
"\n",
|
336 |
"matching_cols = [\n",
|
337 |
" \"RegionID\",\n",
|
338 |
" \"Date\",\n",
|
@@ -340,29 +340,27 @@
|
|
340 |
" \"RegionName\",\n",
|
341 |
" \"RegionType\",\n",
|
342 |
" \"StateName\",\n",
|
343 |
-
" # \"Value Type\",\n",
|
344 |
" \"Home Type\",\n",
|
345 |
"]\n",
|
346 |
"\n",
|
347 |
-
"
|
348 |
-
"
|
349 |
-
"
|
350 |
-
"
|
351 |
-
"
|
352 |
-
"
|
353 |
-
"combined_df
|
354 |
-
"
|
355 |
-
"
|
356 |
-
"
|
357 |
-
"
|
358 |
-
")\n",
|
359 |
"\n",
|
360 |
"combined_df"
|
361 |
]
|
362 |
},
|
363 |
{
|
364 |
"cell_type": "code",
|
365 |
-
"execution_count":
|
366 |
"metadata": {},
|
367 |
"outputs": [
|
368 |
{
|
@@ -393,9 +391,9 @@
|
|
393 |
" <th>State</th>\n",
|
394 |
" <th>Home Type</th>\n",
|
395 |
" <th>Date</th>\n",
|
396 |
-
" <th>Sale Price</th>\n",
|
397 |
-
" <th>Sale Price
|
398 |
-
" <th>Count</th>\n",
|
399 |
" </tr>\n",
|
400 |
" </thead>\n",
|
401 |
" <tbody>\n",
|
@@ -408,8 +406,8 @@
|
|
408 |
" <td>NaN</td>\n",
|
409 |
" <td>SFR</td>\n",
|
410 |
" <td>2018-01-31</td>\n",
|
411 |
-
" <td>309000.0</td>\n",
|
412 |
" <td>137.412316</td>\n",
|
|
|
413 |
" <td>33940.0</td>\n",
|
414 |
" </tr>\n",
|
415 |
" <tr>\n",
|
@@ -421,8 +419,8 @@
|
|
421 |
" <td>NaN</td>\n",
|
422 |
" <td>all homes</td>\n",
|
423 |
" <td>2018-01-31</td>\n",
|
424 |
-
" <td>314596.0</td>\n",
|
425 |
" <td>140.504620</td>\n",
|
|
|
426 |
" <td>37135.0</td>\n",
|
427 |
" </tr>\n",
|
428 |
" <tr>\n",
|
@@ -434,8 +432,8 @@
|
|
434 |
" <td>NaN</td>\n",
|
435 |
" <td>condo/co-op only</td>\n",
|
436 |
" <td>2018-01-31</td>\n",
|
437 |
-
" <td>388250.0</td>\n",
|
438 |
" <td>238.300000</td>\n",
|
|
|
439 |
" <td>3195.0</td>\n",
|
440 |
" </tr>\n",
|
441 |
" <tr>\n",
|
@@ -447,8 +445,8 @@
|
|
447 |
" <td>NaN</td>\n",
|
448 |
" <td>SFR</td>\n",
|
449 |
" <td>2018-02-28</td>\n",
|
450 |
-
" <td>309072.5</td>\n",
|
451 |
" <td>137.199170</td>\n",
|
|
|
452 |
" <td>33304.0</td>\n",
|
453 |
" </tr>\n",
|
454 |
" <tr>\n",
|
@@ -460,8 +458,8 @@
|
|
460 |
" <td>NaN</td>\n",
|
461 |
" <td>all homes</td>\n",
|
462 |
" <td>2018-02-28</td>\n",
|
463 |
-
" <td>314608.0</td>\n",
|
464 |
" <td>140.304966</td>\n",
|
|
|
465 |
" <td>36493.0</td>\n",
|
466 |
" </tr>\n",
|
467 |
" <tr>\n",
|
@@ -561,23 +559,36 @@
|
|
561 |
"49485 845162 535 Granbury, TX msa TX \n",
|
562 |
"49486 845162 535 Granbury, TX msa TX \n",
|
563 |
"\n",
|
564 |
-
" Home Type Date
|
565 |
-
"0 SFR 2018-01-31
|
566 |
-
"1 all homes 2018-01-31
|
567 |
-
"2 condo/co-op only 2018-01-31
|
568 |
-
"3 SFR 2018-02-28
|
569 |
-
"4 all homes 2018-02-28
|
570 |
-
"... ... ...
|
571 |
-
"49482 all homes 2023-09-30
|
572 |
-
"49483 SFR 2023-10-31
|
573 |
-
"49484 all homes 2023-10-31
|
574 |
-
"49485 SFR 2023-11-30
|
575 |
-
"49486 all homes 2023-11-30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
"\n",
|
577 |
"[49487 rows x 10 columns]"
|
578 |
]
|
579 |
},
|
580 |
-
"execution_count":
|
581 |
"metadata": {},
|
582 |
"output_type": "execute_result"
|
583 |
}
|
@@ -599,7 +610,7 @@
|
|
599 |
},
|
600 |
{
|
601 |
"cell_type": "code",
|
602 |
-
"execution_count":
|
603 |
"metadata": {},
|
604 |
"outputs": [],
|
605 |
"source": [
|
@@ -608,13 +619,6 @@
|
|
608 |
"\n",
|
609 |
"final_df.to_json(FULL_PROCESSED_DIR_PATH + \"final.jsonl\", orient=\"records\", lines=True)"
|
610 |
]
|
611 |
-
},
|
612 |
-
{
|
613 |
-
"cell_type": "code",
|
614 |
-
"execution_count": null,
|
615 |
-
"metadata": {},
|
616 |
-
"outputs": [],
|
617 |
-
"source": []
|
618 |
}
|
619 |
],
|
620 |
"metadata": {
|
|
|
25 |
},
|
26 |
{
|
27 |
"cell_type": "code",
|
28 |
+
"execution_count": 56,
|
29 |
"metadata": {},
|
30 |
"outputs": [
|
31 |
{
|
|
|
71 |
" <th>StateName</th>\n",
|
72 |
" <th>Home Type</th>\n",
|
73 |
" <th>Date</th>\n",
|
74 |
+
" <th>Median Sale Price per Sqft</th>\n",
|
75 |
+
" <th>Median Sale Price</th>\n",
|
76 |
+
" <th>Sales Count</th>\n",
|
77 |
" </tr>\n",
|
78 |
" </thead>\n",
|
79 |
" <tbody>\n",
|
|
|
86 |
" <td>NaN</td>\n",
|
87 |
" <td>SFR</td>\n",
|
88 |
" <td>2018-01-31</td>\n",
|
|
|
89 |
" <td>137.412316</td>\n",
|
90 |
+
" <td>309000.0</td>\n",
|
91 |
" <td>33940.0</td>\n",
|
92 |
" </tr>\n",
|
93 |
" <tr>\n",
|
|
|
99 |
" <td>NaN</td>\n",
|
100 |
" <td>all homes</td>\n",
|
101 |
" <td>2018-01-31</td>\n",
|
|
|
102 |
" <td>140.504620</td>\n",
|
103 |
+
" <td>314596.0</td>\n",
|
104 |
" <td>37135.0</td>\n",
|
105 |
" </tr>\n",
|
106 |
" <tr>\n",
|
|
|
112 |
" <td>NaN</td>\n",
|
113 |
" <td>condo/co-op only</td>\n",
|
114 |
" <td>2018-01-31</td>\n",
|
|
|
115 |
" <td>238.300000</td>\n",
|
116 |
+
" <td>388250.0</td>\n",
|
117 |
" <td>3195.0</td>\n",
|
118 |
" </tr>\n",
|
119 |
" <tr>\n",
|
|
|
125 |
" <td>NaN</td>\n",
|
126 |
" <td>SFR</td>\n",
|
127 |
" <td>2018-02-28</td>\n",
|
|
|
128 |
" <td>137.199170</td>\n",
|
129 |
+
" <td>309072.5</td>\n",
|
130 |
" <td>33304.0</td>\n",
|
131 |
" </tr>\n",
|
132 |
" <tr>\n",
|
|
|
138 |
" <td>NaN</td>\n",
|
139 |
" <td>all homes</td>\n",
|
140 |
" <td>2018-02-28</td>\n",
|
|
|
141 |
" <td>140.304966</td>\n",
|
142 |
+
" <td>314608.0</td>\n",
|
143 |
" <td>36493.0</td>\n",
|
144 |
" </tr>\n",
|
145 |
" <tr>\n",
|
|
|
239 |
"49485 845162 535 Granbury, TX msa TX \n",
|
240 |
"49486 845162 535 Granbury, TX msa TX \n",
|
241 |
"\n",
|
242 |
+
" Home Type Date Median Sale Price per Sqft \\\n",
|
243 |
+
"0 SFR 2018-01-31 137.412316 \n",
|
244 |
+
"1 all homes 2018-01-31 140.504620 \n",
|
245 |
+
"2 condo/co-op only 2018-01-31 238.300000 \n",
|
246 |
+
"3 SFR 2018-02-28 137.199170 \n",
|
247 |
+
"4 all homes 2018-02-28 140.304966 \n",
|
248 |
+
"... ... ... ... \n",
|
249 |
+
"49482 all homes 2023-09-30 NaN \n",
|
250 |
+
"49483 SFR 2023-10-31 NaN \n",
|
251 |
+
"49484 all homes 2023-10-31 NaN \n",
|
252 |
+
"49485 SFR 2023-11-30 NaN \n",
|
253 |
+
"49486 all homes 2023-11-30 NaN \n",
|
254 |
+
"\n",
|
255 |
+
" Median Sale Price Sales Count \n",
|
256 |
+
"0 309000.0 33940.0 \n",
|
257 |
+
"1 314596.0 37135.0 \n",
|
258 |
+
"2 388250.0 3195.0 \n",
|
259 |
+
"3 309072.5 33304.0 \n",
|
260 |
+
"4 314608.0 36493.0 \n",
|
261 |
+
"... ... ... \n",
|
262 |
+
"49482 NaN 26.0 \n",
|
263 |
+
"49483 NaN 24.0 \n",
|
264 |
+
"49484 NaN 24.0 \n",
|
265 |
+
"49485 NaN 16.0 \n",
|
266 |
+
"49486 NaN 16.0 \n",
|
267 |
"\n",
|
268 |
"[49487 rows x 10 columns]"
|
269 |
]
|
270 |
},
|
271 |
+
"execution_count": 56,
|
272 |
"metadata": {},
|
273 |
"output_type": "execute_result"
|
274 |
}
|
275 |
],
|
276 |
"source": [
|
|
|
|
|
277 |
"# base cols RegionID,SizeRank,RegionName,RegionType,StateName\n",
|
278 |
"\n",
|
279 |
"exclude_columns = [\n",
|
|
|
282 |
" \"RegionName\",\n",
|
283 |
" \"RegionType\",\n",
|
284 |
" \"StateName\",\n",
|
|
|
285 |
" \"Home Type\",\n",
|
286 |
"]\n",
|
287 |
"\n",
|
288 |
+
"batches = {\"median_sale_price_per_sqft\": [], \"median_sale_price\": [], \"sales_count\": []}\n",
|
|
|
|
|
289 |
"\n",
|
290 |
"for filename in os.listdir(FULL_DATA_DIR_PATH):\n",
|
291 |
" if filename.endswith(\".csv\"):\n",
|
|
|
302 |
" # Identify columns to pivot\n",
|
303 |
" columns_to_pivot = [col for col in cur_df.columns if col not in exclude_columns]\n",
|
304 |
"\n",
|
305 |
+
" if \"median_sale_price_per_sqft\" in filename:\n",
|
|
|
|
|
306 |
" cur_df = pd.melt(\n",
|
307 |
" cur_df,\n",
|
308 |
" id_vars=exclude_columns,\n",
|
309 |
" value_vars=columns_to_pivot,\n",
|
310 |
" var_name=\"Date\",\n",
|
311 |
+
" value_name=\"Median Sale Price per Sqft\",\n",
|
312 |
" )\n",
|
313 |
+
" batches[\"median_sale_price_per_sqft\"].append(cur_df)\n",
|
314 |
"\n",
|
315 |
+
" elif \"median_sale_price\" in filename:\n",
|
|
|
316 |
" cur_df = pd.melt(\n",
|
317 |
" cur_df,\n",
|
318 |
" id_vars=exclude_columns,\n",
|
319 |
" value_vars=columns_to_pivot,\n",
|
320 |
" var_name=\"Date\",\n",
|
321 |
+
" value_name=\"Median Sale Price\",\n",
|
322 |
" )\n",
|
323 |
+
" batches[\"median_sale_price\"].append(cur_df)\n",
|
324 |
"\n",
|
325 |
+
" elif \"sales_count\" in filename:\n",
|
|
|
326 |
" cur_df = pd.melt(\n",
|
327 |
" cur_df,\n",
|
328 |
" id_vars=exclude_columns,\n",
|
329 |
" value_vars=columns_to_pivot,\n",
|
330 |
" var_name=\"Date\",\n",
|
331 |
+
" value_name=\"Sales Count\",\n",
|
332 |
" )\n",
|
333 |
+
" batches[\"sales_count\"].append(cur_df)\n",
|
334 |
"\n",
|
335 |
"\n",
|
|
|
|
|
|
|
|
|
336 |
"matching_cols = [\n",
|
337 |
" \"RegionID\",\n",
|
338 |
" \"Date\",\n",
|
|
|
340 |
" \"RegionName\",\n",
|
341 |
" \"RegionType\",\n",
|
342 |
" \"StateName\",\n",
|
|
|
343 |
" \"Home Type\",\n",
|
344 |
"]\n",
|
345 |
"\n",
|
346 |
+
"combined_batches = [pd.concat(cur_batch) for cur_batch in batches.values()]\n",
|
347 |
+
"\n",
|
348 |
+
"if len(combined_batches) > 0:\n",
|
349 |
+
" combined_df = combined_batches[0]\n",
|
350 |
+
" for batch in combined_batches[1:]:\n",
|
351 |
+
" combined_df = pd.merge(\n",
|
352 |
+
" combined_df,\n",
|
353 |
+
" batch,\n",
|
354 |
+
" on=matching_cols,\n",
|
355 |
+
" how=\"outer\",\n",
|
356 |
+
" )\n",
|
|
|
357 |
"\n",
|
358 |
"combined_df"
|
359 |
]
|
360 |
},
|
361 |
{
|
362 |
"cell_type": "code",
|
363 |
+
"execution_count": 57,
|
364 |
"metadata": {},
|
365 |
"outputs": [
|
366 |
{
|
|
|
391 |
" <th>State</th>\n",
|
392 |
" <th>Home Type</th>\n",
|
393 |
" <th>Date</th>\n",
|
394 |
+
" <th>Median Sale Price per Sqft</th>\n",
|
395 |
+
" <th>Median Sale Price</th>\n",
|
396 |
+
" <th>Sales Count</th>\n",
|
397 |
" </tr>\n",
|
398 |
" </thead>\n",
|
399 |
" <tbody>\n",
|
|
|
406 |
" <td>NaN</td>\n",
|
407 |
" <td>SFR</td>\n",
|
408 |
" <td>2018-01-31</td>\n",
|
|
|
409 |
" <td>137.412316</td>\n",
|
410 |
+
" <td>309000.0</td>\n",
|
411 |
" <td>33940.0</td>\n",
|
412 |
" </tr>\n",
|
413 |
" <tr>\n",
|
|
|
419 |
" <td>NaN</td>\n",
|
420 |
" <td>all homes</td>\n",
|
421 |
" <td>2018-01-31</td>\n",
|
|
|
422 |
" <td>140.504620</td>\n",
|
423 |
+
" <td>314596.0</td>\n",
|
424 |
" <td>37135.0</td>\n",
|
425 |
" </tr>\n",
|
426 |
" <tr>\n",
|
|
|
432 |
" <td>NaN</td>\n",
|
433 |
" <td>condo/co-op only</td>\n",
|
434 |
" <td>2018-01-31</td>\n",
|
|
|
435 |
" <td>238.300000</td>\n",
|
436 |
+
" <td>388250.0</td>\n",
|
437 |
" <td>3195.0</td>\n",
|
438 |
" </tr>\n",
|
439 |
" <tr>\n",
|
|
|
445 |
" <td>NaN</td>\n",
|
446 |
" <td>SFR</td>\n",
|
447 |
" <td>2018-02-28</td>\n",
|
|
|
448 |
" <td>137.199170</td>\n",
|
449 |
+
" <td>309072.5</td>\n",
|
450 |
" <td>33304.0</td>\n",
|
451 |
" </tr>\n",
|
452 |
" <tr>\n",
|
|
|
458 |
" <td>NaN</td>\n",
|
459 |
" <td>all homes</td>\n",
|
460 |
" <td>2018-02-28</td>\n",
|
|
|
461 |
" <td>140.304966</td>\n",
|
462 |
+
" <td>314608.0</td>\n",
|
463 |
" <td>36493.0</td>\n",
|
464 |
" </tr>\n",
|
465 |
" <tr>\n",
|
|
|
559 |
"49485 845162 535 Granbury, TX msa TX \n",
|
560 |
"49486 845162 535 Granbury, TX msa TX \n",
|
561 |
"\n",
|
562 |
+
" Home Type Date Median Sale Price per Sqft \\\n",
|
563 |
+
"0 SFR 2018-01-31 137.412316 \n",
|
564 |
+
"1 all homes 2018-01-31 140.504620 \n",
|
565 |
+
"2 condo/co-op only 2018-01-31 238.300000 \n",
|
566 |
+
"3 SFR 2018-02-28 137.199170 \n",
|
567 |
+
"4 all homes 2018-02-28 140.304966 \n",
|
568 |
+
"... ... ... ... \n",
|
569 |
+
"49482 all homes 2023-09-30 NaN \n",
|
570 |
+
"49483 SFR 2023-10-31 NaN \n",
|
571 |
+
"49484 all homes 2023-10-31 NaN \n",
|
572 |
+
"49485 SFR 2023-11-30 NaN \n",
|
573 |
+
"49486 all homes 2023-11-30 NaN \n",
|
574 |
+
"\n",
|
575 |
+
" Median Sale Price Sales Count \n",
|
576 |
+
"0 309000.0 33940.0 \n",
|
577 |
+
"1 314596.0 37135.0 \n",
|
578 |
+
"2 388250.0 3195.0 \n",
|
579 |
+
"3 309072.5 33304.0 \n",
|
580 |
+
"4 314608.0 36493.0 \n",
|
581 |
+
"... ... ... \n",
|
582 |
+
"49482 NaN 26.0 \n",
|
583 |
+
"49483 NaN 24.0 \n",
|
584 |
+
"49484 NaN 24.0 \n",
|
585 |
+
"49485 NaN 16.0 \n",
|
586 |
+
"49486 NaN 16.0 \n",
|
587 |
"\n",
|
588 |
"[49487 rows x 10 columns]"
|
589 |
]
|
590 |
},
|
591 |
+
"execution_count": 57,
|
592 |
"metadata": {},
|
593 |
"output_type": "execute_result"
|
594 |
}
|
|
|
610 |
},
|
611 |
{
|
612 |
"cell_type": "code",
|
613 |
+
"execution_count": 58,
|
614 |
"metadata": {},
|
615 |
"outputs": [],
|
616 |
"source": [
|
|
|
619 |
"\n",
|
620 |
"final_df.to_json(FULL_PROCESSED_DIR_PATH + \"final.jsonl\", orient=\"records\", lines=True)"
|
621 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
}
|
623 |
],
|
624 |
"metadata": {
|
zillow.py
CHANGED
@@ -132,11 +132,13 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
132 |
"State": datasets.Value(dtype="string", id="State"),
|
133 |
"Home Type": datasets.Value(dtype="string", id="Home Type"),
|
134 |
"Date": datasets.Value(dtype="string", id="Date"),
|
135 |
-
"Sale Price": datasets.Value(
|
136 |
-
|
137 |
-
dtype="float32", id="Sale Price per Sqft"
|
138 |
),
|
139 |
-
"
|
|
|
|
|
|
|
140 |
# These are the features of your dataset like images, labels ...
|
141 |
}
|
142 |
)
|
@@ -255,9 +257,11 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
255 |
"State": data["State"],
|
256 |
"Home Type": data["Home Type"],
|
257 |
"Date": data["Date"],
|
258 |
-
"Sale Price": data["Sale Price"],
|
259 |
-
"Sale Price per Sqft": data[
|
260 |
-
|
|
|
|
|
261 |
# "answer": "" if split == "test" else data["answer"],
|
262 |
}
|
263 |
# else:
|
|
|
132 |
"State": datasets.Value(dtype="string", id="State"),
|
133 |
"Home Type": datasets.Value(dtype="string", id="Home Type"),
|
134 |
"Date": datasets.Value(dtype="string", id="Date"),
|
135 |
+
"Median Sale Price": datasets.Value(
|
136 |
+
dtype="float32", id="Median Sale Price"
|
|
|
137 |
),
|
138 |
+
"Median Sale Price per Sqft": datasets.Value(
|
139 |
+
dtype="float32", id="Median Sale Price per Sqft"
|
140 |
+
),
|
141 |
+
"Sales Count": datasets.Value(dtype="int32", id="Sales Count"),
|
142 |
# These are the features of your dataset like images, labels ...
|
143 |
}
|
144 |
)
|
|
|
257 |
"State": data["State"],
|
258 |
"Home Type": data["Home Type"],
|
259 |
"Date": data["Date"],
|
260 |
+
"Median Sale Price": data["Median Sale Price"],
|
261 |
+
"Median Sale Price per Sqft": data[
|
262 |
+
"Median Sale Price per Sqft"
|
263 |
+
],
|
264 |
+
"Sales Count": data["Sales Count"],
|
265 |
# "answer": "" if split == "test" else data["answer"],
|
266 |
}
|
267 |
# else:
|