Skip to content

Commit

Permalink
Update housing unstacked with county name
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-goyal committed Nov 3, 2019
1 parent d383abe commit 15523be
Show file tree
Hide file tree
Showing 2 changed files with 270,136 additions and 267,826 deletions.
45 changes: 33 additions & 12 deletions Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16530,7 +16530,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 90,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -16673,6 +16673,7 @@
" <th>2019-07</th>\n",
" <th>2019-08</th>\n",
" <th>2019-09</th>\n",
" <th>County State</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
Expand Down Expand Up @@ -16797,6 +16798,7 @@
" <td>174317.0</td>\n",
" <td>189000.0</td>\n",
" <td>184500.0</td>\n",
" <td>Valdez Cordova , AK</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
Expand Down Expand Up @@ -16919,6 +16921,7 @@
" <td>400000.0</td>\n",
" <td>399000.0</td>\n",
" <td>397000.0</td>\n",
" <td>Sitka , AK</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
Expand Down Expand Up @@ -17041,6 +17044,7 @@
" <td>279900.0</td>\n",
" <td>279000.0</td>\n",
" <td>276450.0</td>\n",
" <td>Matanuska Susitna , AK</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
Expand Down Expand Up @@ -17163,6 +17167,7 @@
" <td>319250.0</td>\n",
" <td>297250.0</td>\n",
" <td>289000.0</td>\n",
" <td>Ketchikan Gateway , AK</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
Expand Down Expand Up @@ -17285,6 +17290,7 @@
" <td>325000.0</td>\n",
" <td>325000.0</td>\n",
" <td>318000.0</td>\n",
" <td>Anchorage , AK</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand Down Expand Up @@ -17403,21 +17409,29 @@
"3 322500.0 300000.0 287000.0 285000.0 280000.0 287250.0 285000.0 \n",
"4 319638.5 314777.0 310000.0 310000.0 309900.0 310000.0 314000.0 \n",
"\n",
" 2019-03 2019-04 2019-05 2019-06 2019-07 2019-08 2019-09 \n",
"0 149500.0 150000.0 172500.0 168036.0 174317.0 189000.0 184500.0 \n",
"1 457000.0 424500.0 428500.0 419000.0 400000.0 399000.0 397000.0 \n",
"2 276500.0 279950.0 279900.0 279900.0 279900.0 279000.0 276450.0 \n",
"3 309000.0 310000.0 329000.0 325000.0 319250.0 297250.0 289000.0 \n",
"4 318000.0 329000.0 335000.0 330000.0 325000.0 325000.0 318000.0 "
" 2019-03 2019-04 2019-05 2019-06 2019-07 2019-08 2019-09 \\\n",
"0 149500.0 150000.0 172500.0 168036.0 174317.0 189000.0 184500.0 \n",
"1 457000.0 424500.0 428500.0 419000.0 400000.0 399000.0 397000.0 \n",
"2 276500.0 279950.0 279900.0 279900.0 279900.0 279000.0 276450.0 \n",
"3 309000.0 310000.0 329000.0 325000.0 319250.0 297250.0 289000.0 \n",
"4 318000.0 329000.0 335000.0 330000.0 325000.0 325000.0 318000.0 \n",
"\n",
" County State \n",
"0 Valdez Cordova , AK \n",
"1 Sitka , AK \n",
"2 Matanuska Susitna , AK \n",
"3 Ketchikan Gateway , AK \n",
"4 Anchorage , AK "
]
},
"execution_count": 55,
"execution_count": 90,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"housing = pd.read_csv(\"data/Housing Parsing.csv\")\n",
"housing[\"County State\"] = housing[\"RegionName\"] + \", \" + housing[\"State\"]\n",
"housing.head()"
]
},
Expand All @@ -17431,15 +17445,15 @@
"i = 0\n",
"for key, value in housing[housing.columns[2:]].iteritems():\n",
" for val in range(len(value)):\n",
" di[i] = {\"region\": housing[\"RegionName\"][val], \"key\": key, \"value\": value[val]}\n",
" di[i] = {\"County State\": housing[\"RegionName\"][val], \"key\": key, \"value\": value[val]}\n",
" i = i + 1\n",
"\n",
"newHousing = pd.DataFrame.from_dict(di, \"index\")"
]
},
{
"cell_type": "code",
"execution_count": 88,
"execution_count": 89,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -17907,15 +17921,22 @@
"[267813 rows x 3 columns]"
]
},
"execution_count": 88,
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"newHousing.to_csv(\"Ho\")\n",
"newHousing.to_csv(\"Housing Unstacked Parsed.csv\")\n",
"newHousing"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 15523be

Please sign in to comment.