misikoff commited on
Commit
3355ad5
β€’
1 Parent(s): 248e780

feat: add rentals

Browse files
data/rentals/City_zori_uc_sfrcondomfr_sm_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/City_zori_uc_sfrcondomfr_sm_sa_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/County_zori_uc_sfrcondomfr_sm_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/County_zori_uc_sfrcondomfr_sm_sa_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Metro_zori_uc_mfr_sm_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Metro_zori_uc_mfr_sm_sa_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Metro_zori_uc_sfr_sm_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Metro_zori_uc_sfr_sm_sa_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Metro_zori_uc_sfrcondomfr_sm_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Metro_zori_uc_sfrcondomfr_sm_sa_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Zip_zori_uc_sfrcondomfr_sm_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/rentals/Zip_zori_uc_sfrcondomfr_sm_sa_month.csv ADDED
The diff for this file is too large to render. See raw diff
 
processed/rentals/final.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb1ebabaee1148e8960e20e063dd5aebe6dddfdd4013911c4e3cbdd5002328cb
3
+ size 20448052
processors/rentals.ipynb ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 = \"rentals/\"\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": 70,
29
+ "metadata": {},
30
+ "outputs": [
31
+ {
32
+ "name": "stdout",
33
+ "output_type": "stream",
34
+ "text": [
35
+ "Index(['RegionID', 'SizeRank', 'RegionName', 'RegionType', 'StateName',\n",
36
+ " 'Home Type', 'Date', 'Rent (Smoothed)'],\n",
37
+ " dtype='object')\n",
38
+ "['Rent (Smoothed) (Seasonally Adjusted)', 'RegionID', 'Home Type', 'Date']\n",
39
+ "Index(['RegionID', 'SizeRank', 'RegionName', 'RegionType', 'StateName',\n",
40
+ " 'Home Type', 'Date', 'Rent (Smoothed)',\n",
41
+ " 'Rent (Smoothed) (Seasonally Adjusted)'],\n",
42
+ " dtype='object')\n",
43
+ "['RegionID', 'Home Type', 'Date']\n",
44
+ "Index(['RegionID', 'SizeRank', 'RegionName', 'RegionType', 'StateName',\n",
45
+ " 'Home Type', 'Date', 'Rent (Smoothed)',\n",
46
+ " 'Rent (Smoothed) (Seasonally Adjusted)'],\n",
47
+ " dtype='object')\n"
48
+ ]
49
+ },
50
+ {
51
+ "data": {
52
+ "text/html": [
53
+ "<div>\n",
54
+ "<style scoped>\n",
55
+ " .dataframe tbody tr th:only-of-type {\n",
56
+ " vertical-align: middle;\n",
57
+ " }\n",
58
+ "\n",
59
+ " .dataframe tbody tr th {\n",
60
+ " vertical-align: top;\n",
61
+ " }\n",
62
+ "\n",
63
+ " .dataframe thead th {\n",
64
+ " text-align: right;\n",
65
+ " }\n",
66
+ "</style>\n",
67
+ "<table border=\"1\" class=\"dataframe\">\n",
68
+ " <thead>\n",
69
+ " <tr style=\"text-align: right;\">\n",
70
+ " <th></th>\n",
71
+ " <th>RegionID</th>\n",
72
+ " <th>SizeRank</th>\n",
73
+ " <th>RegionName</th>\n",
74
+ " <th>RegionType</th>\n",
75
+ " <th>StateName</th>\n",
76
+ " <th>Home Type</th>\n",
77
+ " <th>Date</th>\n",
78
+ " <th>Rent (Smoothed)</th>\n",
79
+ " <th>Rent (Smoothed) (Seasonally Adjusted)</th>\n",
80
+ " </tr>\n",
81
+ " </thead>\n",
82
+ " <tbody>\n",
83
+ " <tr>\n",
84
+ " <th>0</th>\n",
85
+ " <td>102001</td>\n",
86
+ " <td>0</td>\n",
87
+ " <td>United States</td>\n",
88
+ " <td>country</td>\n",
89
+ " <td>NaN</td>\n",
90
+ " <td>SFR</td>\n",
91
+ " <td>2015-01-31</td>\n",
92
+ " <td>1251.119548</td>\n",
93
+ " <td>1253.380721</td>\n",
94
+ " </tr>\n",
95
+ " <tr>\n",
96
+ " <th>1</th>\n",
97
+ " <td>102001</td>\n",
98
+ " <td>0</td>\n",
99
+ " <td>United States</td>\n",
100
+ " <td>country</td>\n",
101
+ " <td>NaN</td>\n",
102
+ " <td>SFR</td>\n",
103
+ " <td>2015-02-28</td>\n",
104
+ " <td>1257.678915</td>\n",
105
+ " <td>1258.745304</td>\n",
106
+ " </tr>\n",
107
+ " <tr>\n",
108
+ " <th>2</th>\n",
109
+ " <td>102001</td>\n",
110
+ " <td>0</td>\n",
111
+ " <td>United States</td>\n",
112
+ " <td>country</td>\n",
113
+ " <td>NaN</td>\n",
114
+ " <td>SFR</td>\n",
115
+ " <td>2015-03-31</td>\n",
116
+ " <td>1266.242657</td>\n",
117
+ " <td>1263.914519</td>\n",
118
+ " </tr>\n",
119
+ " <tr>\n",
120
+ " <th>3</th>\n",
121
+ " <td>102001</td>\n",
122
+ " <td>0</td>\n",
123
+ " <td>United States</td>\n",
124
+ " <td>country</td>\n",
125
+ " <td>NaN</td>\n",
126
+ " <td>SFR</td>\n",
127
+ " <td>2015-04-30</td>\n",
128
+ " <td>1276.548397</td>\n",
129
+ " <td>1269.232278</td>\n",
130
+ " </tr>\n",
131
+ " <tr>\n",
132
+ " <th>4</th>\n",
133
+ " <td>102001</td>\n",
134
+ " <td>0</td>\n",
135
+ " <td>United States</td>\n",
136
+ " <td>country</td>\n",
137
+ " <td>NaN</td>\n",
138
+ " <td>SFR</td>\n",
139
+ " <td>2015-05-31</td>\n",
140
+ " <td>1286.191645</td>\n",
141
+ " <td>1273.346695</td>\n",
142
+ " </tr>\n",
143
+ " <tr>\n",
144
+ " <th>...</th>\n",
145
+ " <td>...</td>\n",
146
+ " <td>...</td>\n",
147
+ " <td>...</td>\n",
148
+ " <td>...</td>\n",
149
+ " <td>...</td>\n",
150
+ " <td>...</td>\n",
151
+ " <td>...</td>\n",
152
+ " <td>...</td>\n",
153
+ " <td>...</td>\n",
154
+ " </tr>\n",
155
+ " <tr>\n",
156
+ " <th>96007</th>\n",
157
+ " <td>845167</td>\n",
158
+ " <td>296</td>\n",
159
+ " <td>Ottawa, IL</td>\n",
160
+ " <td>msa</td>\n",
161
+ " <td>IL</td>\n",
162
+ " <td>multifamily</td>\n",
163
+ " <td>2023-08-31</td>\n",
164
+ " <td>NaN</td>\n",
165
+ " <td>NaN</td>\n",
166
+ " </tr>\n",
167
+ " <tr>\n",
168
+ " <th>96008</th>\n",
169
+ " <td>845167</td>\n",
170
+ " <td>296</td>\n",
171
+ " <td>Ottawa, IL</td>\n",
172
+ " <td>msa</td>\n",
173
+ " <td>IL</td>\n",
174
+ " <td>multifamily</td>\n",
175
+ " <td>2023-09-30</td>\n",
176
+ " <td>NaN</td>\n",
177
+ " <td>NaN</td>\n",
178
+ " </tr>\n",
179
+ " <tr>\n",
180
+ " <th>96009</th>\n",
181
+ " <td>845167</td>\n",
182
+ " <td>296</td>\n",
183
+ " <td>Ottawa, IL</td>\n",
184
+ " <td>msa</td>\n",
185
+ " <td>IL</td>\n",
186
+ " <td>multifamily</td>\n",
187
+ " <td>2023-10-31</td>\n",
188
+ " <td>NaN</td>\n",
189
+ " <td>NaN</td>\n",
190
+ " </tr>\n",
191
+ " <tr>\n",
192
+ " <th>96010</th>\n",
193
+ " <td>845167</td>\n",
194
+ " <td>296</td>\n",
195
+ " <td>Ottawa, IL</td>\n",
196
+ " <td>msa</td>\n",
197
+ " <td>IL</td>\n",
198
+ " <td>multifamily</td>\n",
199
+ " <td>2023-11-30</td>\n",
200
+ " <td>804.147562</td>\n",
201
+ " <td>NaN</td>\n",
202
+ " </tr>\n",
203
+ " <tr>\n",
204
+ " <th>96011</th>\n",
205
+ " <td>845167</td>\n",
206
+ " <td>296</td>\n",
207
+ " <td>Ottawa, IL</td>\n",
208
+ " <td>msa</td>\n",
209
+ " <td>IL</td>\n",
210
+ " <td>multifamily</td>\n",
211
+ " <td>2023-12-31</td>\n",
212
+ " <td>800.000000</td>\n",
213
+ " <td>NaN</td>\n",
214
+ " </tr>\n",
215
+ " </tbody>\n",
216
+ "</table>\n",
217
+ "<p>96012 rows Γ— 9 columns</p>\n",
218
+ "</div>"
219
+ ],
220
+ "text/plain": [
221
+ " RegionID SizeRank RegionName RegionType StateName Home Type \\\n",
222
+ "0 102001 0 United States country NaN SFR \n",
223
+ "1 102001 0 United States country NaN SFR \n",
224
+ "2 102001 0 United States country NaN SFR \n",
225
+ "3 102001 0 United States country NaN SFR \n",
226
+ "4 102001 0 United States country NaN SFR \n",
227
+ "... ... ... ... ... ... ... \n",
228
+ "96007 845167 296 Ottawa, IL msa IL multifamily \n",
229
+ "96008 845167 296 Ottawa, IL msa IL multifamily \n",
230
+ "96009 845167 296 Ottawa, IL msa IL multifamily \n",
231
+ "96010 845167 296 Ottawa, IL msa IL multifamily \n",
232
+ "96011 845167 296 Ottawa, IL msa IL multifamily \n",
233
+ "\n",
234
+ " Date Rent (Smoothed) Rent (Smoothed) (Seasonally Adjusted) \n",
235
+ "0 2015-01-31 1251.119548 1253.380721 \n",
236
+ "1 2015-02-28 1257.678915 1258.745304 \n",
237
+ "2 2015-03-31 1266.242657 1263.914519 \n",
238
+ "3 2015-04-30 1276.548397 1269.232278 \n",
239
+ "4 2015-05-31 1286.191645 1273.346695 \n",
240
+ "... ... ... ... \n",
241
+ "96007 2023-08-31 NaN NaN \n",
242
+ "96008 2023-09-30 NaN NaN \n",
243
+ "96009 2023-10-31 NaN NaN \n",
244
+ "96010 2023-11-30 804.147562 NaN \n",
245
+ "96011 2023-12-31 800.000000 NaN \n",
246
+ "\n",
247
+ "[96012 rows x 9 columns]"
248
+ ]
249
+ },
250
+ "execution_count": 70,
251
+ "metadata": {},
252
+ "output_type": "execute_result"
253
+ }
254
+ ],
255
+ "source": [
256
+ "# base cols RegionID,SizeRank,RegionName,RegionType,StateName\n",
257
+ "\n",
258
+ "exclude_columns = [\n",
259
+ " \"RegionID\",\n",
260
+ " \"SizeRank\",\n",
261
+ " \"RegionName\",\n",
262
+ " \"RegionType\",\n",
263
+ " \"StateName\",\n",
264
+ " \"Home Type\",\n",
265
+ "]\n",
266
+ "\n",
267
+ "batches = {\"rent\": []}\n",
268
+ "\n",
269
+ "for filename in os.listdir(FULL_DATA_DIR_PATH):\n",
270
+ " if filename.endswith(\".csv\"):\n",
271
+ " # print(\"processing \" + filename)\n",
272
+ " cur_df = pd.read_csv(os.path.join(FULL_DATA_DIR_PATH, filename))\n",
273
+ "\n",
274
+ " if \"_sfrcondomfr_\" in filename:\n",
275
+ " cur_df[\"Home Type\"] = \"all homes plus multifamily\"\n",
276
+ " # skip for now\n",
277
+ " continue\n",
278
+ " elif \"_sfr_\" in filename:\n",
279
+ " cur_df[\"Home Type\"] = \"SFR\"\n",
280
+ " elif \"_mfr_\" in filename:\n",
281
+ " cur_df[\"Home Type\"] = \"multifamily\"\n",
282
+ "\n",
283
+ " # Identify columns to pivot\n",
284
+ " columns_to_pivot = [col for col in cur_df.columns if col not in exclude_columns]\n",
285
+ "\n",
286
+ " smoothed = \"_sm_\" in filename\n",
287
+ " seasonally_adjusted = \"_sa_\" in filename\n",
288
+ "\n",
289
+ " # if \"_mlp_\" in filename:\n",
290
+ " col_name = \"Rent\"\n",
291
+ " if smoothed:\n",
292
+ " col_name += \" (Smoothed)\"\n",
293
+ " if seasonally_adjusted:\n",
294
+ " col_name += \" (Seasonally Adjusted)\"\n",
295
+ " cur_df = pd.melt(\n",
296
+ " cur_df,\n",
297
+ " id_vars=exclude_columns,\n",
298
+ " value_vars=columns_to_pivot,\n",
299
+ " var_name=\"Date\",\n",
300
+ " value_name=col_name,\n",
301
+ " )\n",
302
+ " batches[\"rent\"].append(cur_df)\n",
303
+ " # print(filename)\n",
304
+ "\n",
305
+ "\n",
306
+ "def get_combined_df(data_frames):\n",
307
+ " combined_df = None\n",
308
+ " if len(data_frames) > 1:\n",
309
+ " # iterate over dataframes and merge or concat\n",
310
+ " combined_df = data_frames[0]\n",
311
+ " for i in range(1, len(data_frames)):\n",
312
+ " cur_df = data_frames[i]\n",
313
+ " if combined_df.columns.equals(cur_df.columns):\n",
314
+ " combined_df = pd.concat([combined_df, cur_df])\n",
315
+ " else:\n",
316
+ " cols_to_use = list(cur_df.columns.difference(combined_df.columns))\n",
317
+ " on = [\"RegionID\", \"Home Type\", \"Date\"]\n",
318
+ " for col in on:\n",
319
+ " if col not in cols_to_use:\n",
320
+ " cols_to_use.append(col)\n",
321
+ " print(cols_to_use)\n",
322
+ "\n",
323
+ " combined_df = pd.merge(\n",
324
+ " combined_df,\n",
325
+ " cur_df[cols_to_use],\n",
326
+ " on=on,\n",
327
+ " how=\"outer\",\n",
328
+ " )\n",
329
+ "\n",
330
+ " print(combined_df.columns)\n",
331
+ " elif len(data_frames) == 1:\n",
332
+ " combined_df = data_frames[0]\n",
333
+ "\n",
334
+ " return combined_df\n",
335
+ "\n",
336
+ "\n",
337
+ "combined_df = get_combined_df(batches[\"rent\"])\n",
338
+ "combined_df"
339
+ ]
340
+ },
341
+ {
342
+ "cell_type": "code",
343
+ "execution_count": 71,
344
+ "metadata": {},
345
+ "outputs": [],
346
+ "source": [
347
+ "final_df = combined_df\n",
348
+ "final_df = final_df.rename(\n",
349
+ " columns={\n",
350
+ " \"RegionID\": \"Region ID\",\n",
351
+ " \"SizeRank\": \"Size Rank\",\n",
352
+ " \"RegionName\": \"Region\",\n",
353
+ " \"RegionType\": \"Region Type\",\n",
354
+ " \"StateName\": \"State\",\n",
355
+ " }\n",
356
+ ")\n",
357
+ "\n",
358
+ "# sort by region id and date\n",
359
+ "# final_df.sort_values(by=[\"Region ID\", \"Date\", \"Home Type\"])"
360
+ ]
361
+ },
362
+ {
363
+ "cell_type": "code",
364
+ "execution_count": 72,
365
+ "metadata": {},
366
+ "outputs": [],
367
+ "source": [
368
+ "if not os.path.exists(FULL_PROCESSED_DIR_PATH):\n",
369
+ " os.makedirs(FULL_PROCESSED_DIR_PATH)\n",
370
+ "\n",
371
+ "final_df.to_json(FULL_PROCESSED_DIR_PATH + \"final.jsonl\", orient=\"records\", lines=True)"
372
+ ]
373
+ }
374
+ ],
375
+ "metadata": {
376
+ "kernelspec": {
377
+ "display_name": "Python 3",
378
+ "language": "python",
379
+ "name": "python3"
380
+ },
381
+ "language_info": {
382
+ "codemirror_mode": {
383
+ "name": "ipython",
384
+ "version": 3
385
+ },
386
+ "file_extension": ".py",
387
+ "mimetype": "text/x-python",
388
+ "name": "python",
389
+ "nbconvert_exporter": "python",
390
+ "pygments_lexer": "ipython3",
391
+ "version": "3.12.2"
392
+ }
393
+ },
394
+ "nbformat": 4,
395
+ "nbformat_minor": 2
396
+ }
tester.ipynb CHANGED
@@ -26,25 +26,21 @@
26
  "metadata": {},
27
  "outputs": [
28
  {
29
- "ename": "ValueError",
30
- "evalue": "BuilderConfig 'for_sale_listings' not found. Available: ['home_value_forecasts', 'new_constructions']",
31
- "output_type": "error",
32
- "traceback": [
33
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
34
- "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
35
- "Cell \u001b[0;32mIn[3], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m configs \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhome_value_forecasts\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnew_constructions\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfor_sale_listings\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[0;32m----> 3\u001b[0m dataset \u001b[38;5;241m=\u001b[39m \u001b[43mload_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmisikoff/zillow\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfor_sale_listings\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtrust_remote_code\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n",
36
- "File \u001b[0;32m~/opt/anaconda3/envs/sta663/lib/python3.12/site-packages/datasets/load.py:2548\u001b[0m, in \u001b[0;36mload_dataset\u001b[0;34m(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, token, use_auth_token, task, streaming, num_proc, storage_options, trust_remote_code, **config_kwargs)\u001b[0m\n\u001b[1;32m 2543\u001b[0m verification_mode \u001b[38;5;241m=\u001b[39m VerificationMode(\n\u001b[1;32m 2544\u001b[0m (verification_mode \u001b[38;5;129;01mor\u001b[39;00m VerificationMode\u001b[38;5;241m.\u001b[39mBASIC_CHECKS) \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m save_infos \u001b[38;5;28;01melse\u001b[39;00m VerificationMode\u001b[38;5;241m.\u001b[39mALL_CHECKS\n\u001b[1;32m 2545\u001b[0m )\n\u001b[1;32m 2547\u001b[0m \u001b[38;5;66;03m# Create a dataset builder\u001b[39;00m\n\u001b[0;32m-> 2548\u001b[0m builder_instance \u001b[38;5;241m=\u001b[39m \u001b[43mload_dataset_builder\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2549\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2550\u001b[0m \u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2551\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2552\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_files\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_files\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2553\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2554\u001b[0m \u001b[43m \u001b[49m\u001b[43mfeatures\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfeatures\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2555\u001b[0m \u001b[43m \u001b[49m\u001b[43mdownload_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdownload_config\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2556\u001b[0m \u001b[43m \u001b[49m\u001b[43mdownload_mode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdownload_mode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2557\u001b[0m \u001b[43m \u001b[49m\u001b[43mrevision\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrevision\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2558\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2559\u001b[0m \u001b[43m \u001b[49m\u001b[43mstorage_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstorage_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2560\u001b[0m \u001b[43m \u001b[49m\u001b[43mtrust_remote_code\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtrust_remote_code\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2561\u001b[0m \u001b[43m \u001b[49m\u001b[43m_require_default_config_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mis\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 2562\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mconfig_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2563\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2565\u001b[0m \u001b[38;5;66;03m# Return iterable dataset in case of streaming\u001b[39;00m\n\u001b[1;32m 2566\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m streaming:\n",
37
- "File \u001b[0;32m~/opt/anaconda3/envs/sta663/lib/python3.12/site-packages/datasets/load.py:2257\u001b[0m, in \u001b[0;36mload_dataset_builder\u001b[0;34m(path, name, data_dir, data_files, cache_dir, features, download_config, download_mode, revision, token, use_auth_token, storage_options, trust_remote_code, _require_default_config_name, **config_kwargs)\u001b[0m\n\u001b[1;32m 2255\u001b[0m builder_cls \u001b[38;5;241m=\u001b[39m get_dataset_builder_class(dataset_module, dataset_name\u001b[38;5;241m=\u001b[39mdataset_name)\n\u001b[1;32m 2256\u001b[0m \u001b[38;5;66;03m# Instantiate the dataset builder\u001b[39;00m\n\u001b[0;32m-> 2257\u001b[0m builder_instance: DatasetBuilder \u001b[38;5;241m=\u001b[39m \u001b[43mbuilder_cls\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2258\u001b[0m \u001b[43m \u001b[49m\u001b[43mcache_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2259\u001b[0m \u001b[43m \u001b[49m\u001b[43mdataset_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdataset_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2260\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2261\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_dir\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2262\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_files\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdata_files\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2263\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mhash\u001b[39;49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdataset_module\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhash\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2264\u001b[0m \u001b[43m \u001b[49m\u001b[43minfo\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minfo\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2265\u001b[0m \u001b[43m \u001b[49m\u001b[43mfeatures\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfeatures\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2266\u001b[0m \u001b[43m \u001b[49m\u001b[43mtoken\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtoken\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2267\u001b[0m \u001b[43m \u001b[49m\u001b[43mstorage_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstorage_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2268\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mbuilder_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2269\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mconfig_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2270\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2271\u001b[0m builder_instance\u001b[38;5;241m.\u001b[39m_use_legacy_cache_dir_if_possible(dataset_module)\n\u001b[1;32m 2273\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m builder_instance\n",
38
- "File \u001b[0;32m~/opt/anaconda3/envs/sta663/lib/python3.12/site-packages/datasets/builder.py:371\u001b[0m, in \u001b[0;36mDatasetBuilder.__init__\u001b[0;34m(self, cache_dir, dataset_name, config_name, hash, base_path, info, features, token, use_auth_token, repo_id, data_files, data_dir, storage_options, writer_batch_size, name, **config_kwargs)\u001b[0m\n\u001b[1;32m 369\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m data_dir \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 370\u001b[0m config_kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata_dir\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m data_dir\n\u001b[0;32m--> 371\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig_id \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_create_builder_config\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 372\u001b[0m \u001b[43m \u001b[49m\u001b[43mconfig_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconfig_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 373\u001b[0m \u001b[43m \u001b[49m\u001b[43mcustom_features\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfeatures\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 374\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mconfig_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 375\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 377\u001b[0m \u001b[38;5;66;03m# prepare info: DatasetInfo are a standardized dataclass across all datasets\u001b[39;00m\n\u001b[1;32m 378\u001b[0m \u001b[38;5;66;03m# Prefill datasetinfo\u001b[39;00m\n\u001b[1;32m 379\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m info \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 380\u001b[0m \u001b[38;5;66;03m# TODO FOR PACKAGED MODULES IT IMPORTS DATA FROM src/packaged_modules which doesn't make sense\u001b[39;00m\n",
39
- "File \u001b[0;32m~/opt/anaconda3/envs/sta663/lib/python3.12/site-packages/datasets/builder.py:592\u001b[0m, in \u001b[0;36mDatasetBuilder._create_builder_config\u001b[0;34m(self, config_name, custom_features, **config_kwargs)\u001b[0m\n\u001b[1;32m 590\u001b[0m builder_config \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuilder_configs\u001b[38;5;241m.\u001b[39mget(config_name)\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m builder_config \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mBUILDER_CONFIGS:\n\u001b[0;32m--> 592\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 593\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mBuilderConfig \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconfig_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m not found. Available: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlist\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuilder_configs\u001b[38;5;241m.\u001b[39mkeys())\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 594\u001b[0m )\n\u001b[1;32m 596\u001b[0m \u001b[38;5;66;03m# if not using an existing config, then create a new config on the fly\u001b[39;00m\n\u001b[1;32m 597\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m builder_config:\n",
40
- "\u001b[0;31mValueError\u001b[0m: BuilderConfig 'for_sale_listings' not found. Available: ['home_value_forecasts', 'new_constructions']"
41
  ]
42
  }
43
  ],
44
  "source": [
45
- "configs = [\"home_value_forecasts\", \"new_constructions\", \"for_sale_listings\"]\n",
46
  "\n",
47
- "dataset = load_dataset(\"misikoff/zillow\", \"for_sale_listings\", trust_remote_code=True)"
48
  ]
49
  },
50
  {
 
26
  "metadata": {},
27
  "outputs": [
28
  {
29
+ "name": "stderr",
30
+ "output_type": "stream",
31
+ "text": [
32
+ "Downloading builder script: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 16.4k/16.4k [00:00<00:00, 13.8MB/s]\n",
33
+ "Downloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 739M/739M [00:17<00:00, 42.9MB/s] \n",
34
+ "Generating train split: 2398149 examples [01:07, 35317.36 examples/s]\n",
35
+ "Generating validation split: 2398149 examples [01:08, 35184.06 examples/s]\n",
36
+ "Generating test split: 2398149 examples [01:09, 34579.04 examples/s]\n"
 
 
 
 
37
  ]
38
  }
39
  ],
40
  "source": [
41
+ "configs = [\"home_value_forecasts\", \"new_constructions\", \"for_sale_listings\", \"rentals\"]\n",
42
  "\n",
43
+ "dataset = load_dataset(\"misikoff/zillow\", \"rentals\", trust_remote_code=True)"
44
  ]
45
  },
46
  {
zillow.py CHANGED
@@ -86,6 +86,11 @@ class NewDataset(datasets.GeneratorBasedBuilder):
86
  version=VERSION,
87
  description="This part of my dataset covers a second domain",
88
  ),
 
 
 
 
 
89
  ]
90
 
91
  DEFAULT_CONFIG_NAME = "home_value_forecasts" # It's not mandatory to have a default configuration. Just use one if it make sense.
@@ -172,6 +177,25 @@ class NewDataset(datasets.GeneratorBasedBuilder):
172
  # These are the features of your dataset like images, labels ...
173
  }
174
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  # else: # This is an example to show how to have different features for "home_value_forecasts" and "second_domain"
176
  # features = datasets.Features(
177
  # {
@@ -312,6 +336,22 @@ class NewDataset(datasets.GeneratorBasedBuilder):
312
  "New Pending": data["New Pending"],
313
  # "answer": "" if split == "test" else data["answer"],
314
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  # else:
316
  # yield key, {
317
  # "sentence": data["sentence"],
 
86
  version=VERSION,
87
  description="This part of my dataset covers a second domain",
88
  ),
89
+ datasets.BuilderConfig(
90
+ name="rentals",
91
+ version=VERSION,
92
+ description="This part of my dataset covers a second domain",
93
+ ),
94
  ]
95
 
96
  DEFAULT_CONFIG_NAME = "home_value_forecasts" # It's not mandatory to have a default configuration. Just use one if it make sense.
 
177
  # These are the features of your dataset like images, labels ...
178
  }
179
  )
180
+ elif self.config.name == "rentals":
181
+ features = datasets.Features(
182
+ {
183
+ "Region ID": datasets.Value(dtype="string", id="Region ID"),
184
+ "Size Rank": datasets.Value(dtype="int32", id="Size Rank"),
185
+ "Region": datasets.Value(dtype="string", id="Region"),
186
+ "Region Type": datasets.Value(dtype="string", id="Region Type"),
187
+ "State": datasets.Value(dtype="string", id="State"),
188
+ "Home Type": datasets.Value(dtype="string", id="Home Type"),
189
+ "Date": datasets.Value(dtype="string", id="Date"),
190
+ "Rent (Smoothed)": datasets.Value(
191
+ dtype="float32", id="Rent (Smoothed)"
192
+ ),
193
+ "Rent (Smoothed) (Seasonally Adjusted)": datasets.Value(
194
+ dtype="float32", id="Rent (Smoothed) (Seasonally Adjusted)"
195
+ ),
196
+ # These are the features of your dataset like images, labels ...
197
+ }
198
+ )
199
  # else: # This is an example to show how to have different features for "home_value_forecasts" and "second_domain"
200
  # features = datasets.Features(
201
  # {
 
336
  "New Pending": data["New Pending"],
337
  # "answer": "" if split == "test" else data["answer"],
338
  }
339
+ elif self.config.name == "rentals":
340
+ # Yields examples as (key, example) tuples
341
+ yield key, {
342
+ "Region ID": data["Region ID"],
343
+ "Size Rank": data["Size Rank"],
344
+ "Region": data["Region"],
345
+ "Region Type": data["Region Type"],
346
+ "State": data["State"],
347
+ "Home Type": data["Home Type"],
348
+ "Date": data["Date"],
349
+ "Rent (Smoothed)": data["Rent (Smoothed)"],
350
+ "Rent (Smoothed) (Seasonally Adjusted)": data[
351
+ "Rent (Smoothed) (Seasonally Adjusted)"
352
+ ],
353
+ # "answer": "" if split == "test" else data["answer"],
354
+ }
355
  # else:
356
  # yield key, {
357
  # "sentence": data["sentence"],