4971 lines
2.1 MiB
Text
4971 lines
2.1 MiB
Text
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"# Descriptive Visualizations\n",
|
|||
|
"\n",
|
|||
|
"The purpose of this notebook is to visually examine the nominal features, discard the useless ones among them, and create new factor variables.\n",
|
|||
|
"\n",
|
|||
|
"The \"main\" plot used in this notebook is *Gr Liv Area* vs. *SalePrice* as the overall living area is the most correlated predictor (which is also very intuitive). Many of the nominal variables change the slopes of the regression lines for sub-groups of data points significantly."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## \"Housekeeping\""
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 1,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"import json\n",
|
|||
|
"\n",
|
|||
|
"import matplotlib.pyplot as plt\n",
|
|||
|
"import numpy as np\n",
|
|||
|
"import pandas as pd\n",
|
|||
|
"import seaborn as sns\n",
|
|||
|
"\n",
|
|||
|
"from sklearn.ensemble import IsolationForest\n",
|
|||
|
"\n",
|
|||
|
"from utils import (\n",
|
|||
|
" ALL_COLUMNS,\n",
|
|||
|
" NOMINAL_VARIABLES,\n",
|
|||
|
" TARGET_VARIABLES,\n",
|
|||
|
" load_clean_data,\n",
|
|||
|
" encode_ordinals,\n",
|
|||
|
" print_column_list,\n",
|
|||
|
")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 2,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"pd.set_option(\"display.max_columns\", 120)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"sns.set_style(\"white\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Load the Data\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 4,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df = load_clean_data(\"data/data_clean_with_transformations.csv\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 5,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"(2898, 86)"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 5,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.shape"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 6,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>1st Flr SF</th>\n",
|
|||
|
" <th>1st Flr SF (box-cox-0)</th>\n",
|
|||
|
" <th>2nd Flr SF</th>\n",
|
|||
|
" <th>3Ssn Porch</th>\n",
|
|||
|
" <th>Alley</th>\n",
|
|||
|
" <th>Bedroom AbvGr</th>\n",
|
|||
|
" <th>Bldg Type</th>\n",
|
|||
|
" <th>Bsmt Cond</th>\n",
|
|||
|
" <th>Bsmt Exposure</th>\n",
|
|||
|
" <th>Bsmt Full Bath</th>\n",
|
|||
|
" <th>Bsmt Half Bath</th>\n",
|
|||
|
" <th>Bsmt Qual</th>\n",
|
|||
|
" <th>Bsmt Unf SF</th>\n",
|
|||
|
" <th>BsmtFin SF 1</th>\n",
|
|||
|
" <th>BsmtFin SF 2</th>\n",
|
|||
|
" <th>BsmtFin Type 1</th>\n",
|
|||
|
" <th>BsmtFin Type 2</th>\n",
|
|||
|
" <th>Central Air</th>\n",
|
|||
|
" <th>Condition 1</th>\n",
|
|||
|
" <th>Condition 2</th>\n",
|
|||
|
" <th>Electrical</th>\n",
|
|||
|
" <th>Enclosed Porch</th>\n",
|
|||
|
" <th>Exter Cond</th>\n",
|
|||
|
" <th>Exter Qual</th>\n",
|
|||
|
" <th>Exterior 1st</th>\n",
|
|||
|
" <th>Exterior 2nd</th>\n",
|
|||
|
" <th>Fence</th>\n",
|
|||
|
" <th>Fireplace Qu</th>\n",
|
|||
|
" <th>Fireplaces</th>\n",
|
|||
|
" <th>Foundation</th>\n",
|
|||
|
" <th>Full Bath</th>\n",
|
|||
|
" <th>Functional</th>\n",
|
|||
|
" <th>Garage Area</th>\n",
|
|||
|
" <th>Garage Cars</th>\n",
|
|||
|
" <th>Garage Cond</th>\n",
|
|||
|
" <th>Garage Finish</th>\n",
|
|||
|
" <th>Garage Qual</th>\n",
|
|||
|
" <th>Garage Type</th>\n",
|
|||
|
" <th>Gr Liv Area</th>\n",
|
|||
|
" <th>Gr Liv Area (box-cox-0)</th>\n",
|
|||
|
" <th>Half Bath</th>\n",
|
|||
|
" <th>Heating</th>\n",
|
|||
|
" <th>Heating QC</th>\n",
|
|||
|
" <th>House Style</th>\n",
|
|||
|
" <th>Kitchen AbvGr</th>\n",
|
|||
|
" <th>Kitchen Qual</th>\n",
|
|||
|
" <th>Land Contour</th>\n",
|
|||
|
" <th>Land Slope</th>\n",
|
|||
|
" <th>Lot Area</th>\n",
|
|||
|
" <th>Lot Area (box-cox-0.1)</th>\n",
|
|||
|
" <th>Lot Config</th>\n",
|
|||
|
" <th>Lot Shape</th>\n",
|
|||
|
" <th>Low Qual Fin SF</th>\n",
|
|||
|
" <th>MS SubClass</th>\n",
|
|||
|
" <th>MS Zoning</th>\n",
|
|||
|
" <th>Mas Vnr Area</th>\n",
|
|||
|
" <th>Mas Vnr Type</th>\n",
|
|||
|
" <th>Misc Feature</th>\n",
|
|||
|
" <th>Misc Val</th>\n",
|
|||
|
" <th>Mo Sold</th>\n",
|
|||
|
" <th>Neighborhood</th>\n",
|
|||
|
" <th>Open Porch SF</th>\n",
|
|||
|
" <th>Overall Cond</th>\n",
|
|||
|
" <th>Overall Qual</th>\n",
|
|||
|
" <th>Paved Drive</th>\n",
|
|||
|
" <th>Pool Area</th>\n",
|
|||
|
" <th>Pool QC</th>\n",
|
|||
|
" <th>Roof Matl</th>\n",
|
|||
|
" <th>Roof Style</th>\n",
|
|||
|
" <th>Sale Condition</th>\n",
|
|||
|
" <th>Sale Type</th>\n",
|
|||
|
" <th>Screen Porch</th>\n",
|
|||
|
" <th>Street</th>\n",
|
|||
|
" <th>TotRms AbvGrd</th>\n",
|
|||
|
" <th>Total Bath</th>\n",
|
|||
|
" <th>Total Bsmt SF</th>\n",
|
|||
|
" <th>Total Porch SF</th>\n",
|
|||
|
" <th>Total SF</th>\n",
|
|||
|
" <th>Total SF (box-cox-0.2)</th>\n",
|
|||
|
" <th>Utilities</th>\n",
|
|||
|
" <th>Wood Deck SF</th>\n",
|
|||
|
" <th>Year Built</th>\n",
|
|||
|
" <th>Year Remod/Add</th>\n",
|
|||
|
" <th>Yr Sold</th>\n",
|
|||
|
" <th>SalePrice</th>\n",
|
|||
|
" <th>SalePrice (box-cox-0)</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>1656.0</td>\n",
|
|||
|
" <td>7.412160</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>1Fam</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>441.0</td>\n",
|
|||
|
" <td>639.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>BLQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>BrkFace</td>\n",
|
|||
|
" <td>Plywood</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>CBlock</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>528.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Fin</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Attchd</td>\n",
|
|||
|
" <td>1656.0</td>\n",
|
|||
|
" <td>7.412160</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>GasA</td>\n",
|
|||
|
" <td>Fa</td>\n",
|
|||
|
" <td>1Story</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Lvl</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>31770.0</td>\n",
|
|||
|
" <td>18.196923</td>\n",
|
|||
|
" <td>Corner</td>\n",
|
|||
|
" <td>IR1</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>020</td>\n",
|
|||
|
" <td>RL</td>\n",
|
|||
|
" <td>112.0</td>\n",
|
|||
|
" <td>Stone</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>Names</td>\n",
|
|||
|
" <td>62.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>P</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>CompShg</td>\n",
|
|||
|
" <td>Hip</td>\n",
|
|||
|
" <td>Normal</td>\n",
|
|||
|
" <td>WD</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>Pave</td>\n",
|
|||
|
" <td>7</td>\n",
|
|||
|
" <td>2.0</td>\n",
|
|||
|
" <td>1080.0</td>\n",
|
|||
|
" <td>272.0</td>\n",
|
|||
|
" <td>2736.0</td>\n",
|
|||
|
" <td>19.344072</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>210.0</td>\n",
|
|||
|
" <td>1960</td>\n",
|
|||
|
" <td>1960</td>\n",
|
|||
|
" <td>2010</td>\n",
|
|||
|
" <td>215000.0</td>\n",
|
|||
|
" <td>12.278393</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>896.0</td>\n",
|
|||
|
" <td>6.797940</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>1Fam</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>270.0</td>\n",
|
|||
|
" <td>468.0</td>\n",
|
|||
|
" <td>144.0</td>\n",
|
|||
|
" <td>Rec</td>\n",
|
|||
|
" <td>LwQ</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>Feedr</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>VinylSd</td>\n",
|
|||
|
" <td>VinylSd</td>\n",
|
|||
|
" <td>MnPrv</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>CBlock</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>730.0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Attchd</td>\n",
|
|||
|
" <td>896.0</td>\n",
|
|||
|
" <td>6.797940</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>GasA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1Story</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Lvl</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>11622.0</td>\n",
|
|||
|
" <td>15.499290</td>\n",
|
|||
|
" <td>Inside</td>\n",
|
|||
|
" <td>Reg</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>020</td>\n",
|
|||
|
" <td>RH</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>None</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>Names</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>CompShg</td>\n",
|
|||
|
" <td>Gable</td>\n",
|
|||
|
" <td>Normal</td>\n",
|
|||
|
" <td>WD</td>\n",
|
|||
|
" <td>120.0</td>\n",
|
|||
|
" <td>Pave</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>1.0</td>\n",
|
|||
|
" <td>882.0</td>\n",
|
|||
|
" <td>260.0</td>\n",
|
|||
|
" <td>1778.0</td>\n",
|
|||
|
" <td>17.333478</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>140.0</td>\n",
|
|||
|
" <td>1961</td>\n",
|
|||
|
" <td>1961</td>\n",
|
|||
|
" <td>2010</td>\n",
|
|||
|
" <td>105000.0</td>\n",
|
|||
|
" <td>11.561716</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>1329.0</td>\n",
|
|||
|
" <td>7.192182</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>1Fam</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>406.0</td>\n",
|
|||
|
" <td>923.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>ALQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Wd Sdng</td>\n",
|
|||
|
" <td>Wd Sdng</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>CBlock</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>312.0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Attchd</td>\n",
|
|||
|
" <td>1329.0</td>\n",
|
|||
|
" <td>7.192182</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>GasA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1Story</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>Lvl</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>14267.0</td>\n",
|
|||
|
" <td>16.027549</td>\n",
|
|||
|
" <td>Corner</td>\n",
|
|||
|
" <td>IR1</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>020</td>\n",
|
|||
|
" <td>RL</td>\n",
|
|||
|
" <td>108.0</td>\n",
|
|||
|
" <td>BrkFace</td>\n",
|
|||
|
" <td>Gar2</td>\n",
|
|||
|
" <td>12500.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>Names</td>\n",
|
|||
|
" <td>36.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>CompShg</td>\n",
|
|||
|
" <td>Hip</td>\n",
|
|||
|
" <td>Normal</td>\n",
|
|||
|
" <td>WD</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>Pave</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>1.5</td>\n",
|
|||
|
" <td>1329.0</td>\n",
|
|||
|
" <td>429.0</td>\n",
|
|||
|
" <td>2658.0</td>\n",
|
|||
|
" <td>19.203658</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>393.0</td>\n",
|
|||
|
" <td>1958</td>\n",
|
|||
|
" <td>1958</td>\n",
|
|||
|
" <td>2010</td>\n",
|
|||
|
" <td>172000.0</td>\n",
|
|||
|
" <td>12.055250</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>2110.0</td>\n",
|
|||
|
" <td>7.654443</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>1Fam</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1045.0</td>\n",
|
|||
|
" <td>1065.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>ALQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>BrkFace</td>\n",
|
|||
|
" <td>BrkFace</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>CBlock</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>522.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Fin</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Attchd</td>\n",
|
|||
|
" <td>2110.0</td>\n",
|
|||
|
" <td>7.654443</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>GasA</td>\n",
|
|||
|
" <td>Ex</td>\n",
|
|||
|
" <td>1Story</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Ex</td>\n",
|
|||
|
" <td>Lvl</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>11160.0</td>\n",
|
|||
|
" <td>15.396064</td>\n",
|
|||
|
" <td>Corner</td>\n",
|
|||
|
" <td>Reg</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>020</td>\n",
|
|||
|
" <td>RL</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>None</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>4</td>\n",
|
|||
|
" <td>Names</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>7</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>CompShg</td>\n",
|
|||
|
" <td>Hip</td>\n",
|
|||
|
" <td>Normal</td>\n",
|
|||
|
" <td>WD</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>Pave</td>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>3.5</td>\n",
|
|||
|
" <td>2110.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>4220.0</td>\n",
|
|||
|
" <td>21.548042</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>1968</td>\n",
|
|||
|
" <td>1968</td>\n",
|
|||
|
" <td>2010</td>\n",
|
|||
|
" <td>244000.0</td>\n",
|
|||
|
" <td>12.404924</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>928.0</td>\n",
|
|||
|
" <td>6.833032</td>\n",
|
|||
|
" <td>701.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>1Fam</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>137.0</td>\n",
|
|||
|
" <td>791.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>GLQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>Norm</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>VinylSd</td>\n",
|
|||
|
" <td>VinylSd</td>\n",
|
|||
|
" <td>MnPrv</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>PConc</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>482.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Fin</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Attchd</td>\n",
|
|||
|
" <td>1629.0</td>\n",
|
|||
|
" <td>7.395722</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>GasA</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>2Story</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Lvl</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>13830.0</td>\n",
|
|||
|
" <td>15.946705</td>\n",
|
|||
|
" <td>Inside</td>\n",
|
|||
|
" <td>IR1</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>060</td>\n",
|
|||
|
" <td>RL</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>None</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>Gilbert</td>\n",
|
|||
|
" <td>34.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>CompShg</td>\n",
|
|||
|
" <td>Gable</td>\n",
|
|||
|
" <td>Normal</td>\n",
|
|||
|
" <td>WD</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>Pave</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>2.5</td>\n",
|
|||
|
" <td>928.0</td>\n",
|
|||
|
" <td>246.0</td>\n",
|
|||
|
" <td>2557.0</td>\n",
|
|||
|
" <td>19.016856</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>212.0</td>\n",
|
|||
|
" <td>1997</td>\n",
|
|||
|
" <td>1998</td>\n",
|
|||
|
" <td>2010</td>\n",
|
|||
|
" <td>189900.0</td>\n",
|
|||
|
" <td>12.154253</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" 1st Flr SF 1st Flr SF (box-cox-0) 2nd Flr SF 3Ssn Porch \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1656.0 7.412160 0.0 0.0 \n",
|
|||
|
"2 526350040 896.0 6.797940 0.0 0.0 \n",
|
|||
|
"3 526351010 1329.0 7.192182 0.0 0.0 \n",
|
|||
|
"4 526353030 2110.0 7.654443 0.0 0.0 \n",
|
|||
|
"5 527105010 928.0 6.833032 701.0 0.0 \n",
|
|||
|
"\n",
|
|||
|
" Alley Bedroom AbvGr Bldg Type Bsmt Cond Bsmt Exposure \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 NA 3 1Fam Gd Gd \n",
|
|||
|
"2 526350040 NA 2 1Fam TA No \n",
|
|||
|
"3 526351010 NA 3 1Fam TA No \n",
|
|||
|
"4 526353030 NA 3 1Fam TA No \n",
|
|||
|
"5 527105010 NA 3 1Fam TA No \n",
|
|||
|
"\n",
|
|||
|
" Bsmt Full Bath Bsmt Half Bath Bsmt Qual Bsmt Unf SF \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1 0 TA 441.0 \n",
|
|||
|
"2 526350040 0 0 TA 270.0 \n",
|
|||
|
"3 526351010 0 0 TA 406.0 \n",
|
|||
|
"4 526353030 1 0 TA 1045.0 \n",
|
|||
|
"5 527105010 0 0 Gd 137.0 \n",
|
|||
|
"\n",
|
|||
|
" BsmtFin SF 1 BsmtFin SF 2 BsmtFin Type 1 BsmtFin Type 2 \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 639.0 0.0 BLQ Unf \n",
|
|||
|
"2 526350040 468.0 144.0 Rec LwQ \n",
|
|||
|
"3 526351010 923.0 0.0 ALQ Unf \n",
|
|||
|
"4 526353030 1065.0 0.0 ALQ Unf \n",
|
|||
|
"5 527105010 791.0 0.0 GLQ Unf \n",
|
|||
|
"\n",
|
|||
|
" Central Air Condition 1 Condition 2 Electrical \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Y Norm Norm SBrkr \n",
|
|||
|
"2 526350040 Y Feedr Norm SBrkr \n",
|
|||
|
"3 526351010 Y Norm Norm SBrkr \n",
|
|||
|
"4 526353030 Y Norm Norm SBrkr \n",
|
|||
|
"5 527105010 Y Norm Norm SBrkr \n",
|
|||
|
"\n",
|
|||
|
" Enclosed Porch Exter Cond Exter Qual Exterior 1st \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0.0 TA TA BrkFace \n",
|
|||
|
"2 526350040 0.0 TA TA VinylSd \n",
|
|||
|
"3 526351010 0.0 TA TA Wd Sdng \n",
|
|||
|
"4 526353030 0.0 TA Gd BrkFace \n",
|
|||
|
"5 527105010 0.0 TA TA VinylSd \n",
|
|||
|
"\n",
|
|||
|
" Exterior 2nd Fence Fireplace Qu Fireplaces Foundation \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Plywood NA Gd 2 CBlock \n",
|
|||
|
"2 526350040 VinylSd MnPrv NA 0 CBlock \n",
|
|||
|
"3 526351010 Wd Sdng NA NA 0 CBlock \n",
|
|||
|
"4 526353030 BrkFace NA TA 2 CBlock \n",
|
|||
|
"5 527105010 VinylSd MnPrv TA 1 PConc \n",
|
|||
|
"\n",
|
|||
|
" Full Bath Functional Garage Area Garage Cars Garage Cond \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1 Typ 528.0 2 TA \n",
|
|||
|
"2 526350040 1 Typ 730.0 1 TA \n",
|
|||
|
"3 526351010 1 Typ 312.0 1 TA \n",
|
|||
|
"4 526353030 2 Typ 522.0 2 TA \n",
|
|||
|
"5 527105010 2 Typ 482.0 2 TA \n",
|
|||
|
"\n",
|
|||
|
" Garage Finish Garage Qual Garage Type Gr Liv Area \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Fin TA Attchd 1656.0 \n",
|
|||
|
"2 526350040 Unf TA Attchd 896.0 \n",
|
|||
|
"3 526351010 Unf TA Attchd 1329.0 \n",
|
|||
|
"4 526353030 Fin TA Attchd 2110.0 \n",
|
|||
|
"5 527105010 Fin TA Attchd 1629.0 \n",
|
|||
|
"\n",
|
|||
|
" Gr Liv Area (box-cox-0) Half Bath Heating Heating QC \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 7.412160 0 GasA Fa \n",
|
|||
|
"2 526350040 6.797940 0 GasA TA \n",
|
|||
|
"3 526351010 7.192182 1 GasA TA \n",
|
|||
|
"4 526353030 7.654443 1 GasA Ex \n",
|
|||
|
"5 527105010 7.395722 1 GasA Gd \n",
|
|||
|
"\n",
|
|||
|
" House Style Kitchen AbvGr Kitchen Qual Land Contour \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1Story 1 TA Lvl \n",
|
|||
|
"2 526350040 1Story 1 TA Lvl \n",
|
|||
|
"3 526351010 1Story 1 Gd Lvl \n",
|
|||
|
"4 526353030 1Story 1 Ex Lvl \n",
|
|||
|
"5 527105010 2Story 1 TA Lvl \n",
|
|||
|
"\n",
|
|||
|
" Land Slope Lot Area Lot Area (box-cox-0.1) Lot Config \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Gtl 31770.0 18.196923 Corner \n",
|
|||
|
"2 526350040 Gtl 11622.0 15.499290 Inside \n",
|
|||
|
"3 526351010 Gtl 14267.0 16.027549 Corner \n",
|
|||
|
"4 526353030 Gtl 11160.0 15.396064 Corner \n",
|
|||
|
"5 527105010 Gtl 13830.0 15.946705 Inside \n",
|
|||
|
"\n",
|
|||
|
" Lot Shape Low Qual Fin SF MS SubClass MS Zoning \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 IR1 0.0 020 RL \n",
|
|||
|
"2 526350040 Reg 0.0 020 RH \n",
|
|||
|
"3 526351010 IR1 0.0 020 RL \n",
|
|||
|
"4 526353030 Reg 0.0 020 RL \n",
|
|||
|
"5 527105010 IR1 0.0 060 RL \n",
|
|||
|
"\n",
|
|||
|
" Mas Vnr Area Mas Vnr Type Misc Feature Misc Val Mo Sold \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 112.0 Stone NA 0.0 5 \n",
|
|||
|
"2 526350040 0.0 None NA 0.0 6 \n",
|
|||
|
"3 526351010 108.0 BrkFace Gar2 12500.0 6 \n",
|
|||
|
"4 526353030 0.0 None NA 0.0 4 \n",
|
|||
|
"5 527105010 0.0 None NA 0.0 3 \n",
|
|||
|
"\n",
|
|||
|
" Neighborhood Open Porch SF Overall Cond Overall Qual \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Names 62.0 5 6 \n",
|
|||
|
"2 526350040 Names 0.0 6 5 \n",
|
|||
|
"3 526351010 Names 36.0 6 6 \n",
|
|||
|
"4 526353030 Names 0.0 5 7 \n",
|
|||
|
"5 527105010 Gilbert 34.0 5 5 \n",
|
|||
|
"\n",
|
|||
|
" Paved Drive Pool Area Pool QC Roof Matl Roof Style \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 P 0.0 NA CompShg Hip \n",
|
|||
|
"2 526350040 Y 0.0 NA CompShg Gable \n",
|
|||
|
"3 526351010 Y 0.0 NA CompShg Hip \n",
|
|||
|
"4 526353030 Y 0.0 NA CompShg Hip \n",
|
|||
|
"5 527105010 Y 0.0 NA CompShg Gable \n",
|
|||
|
"\n",
|
|||
|
" Sale Condition Sale Type Screen Porch Street TotRms AbvGrd \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Normal WD 0.0 Pave 7 \n",
|
|||
|
"2 526350040 Normal WD 120.0 Pave 5 \n",
|
|||
|
"3 526351010 Normal WD 0.0 Pave 6 \n",
|
|||
|
"4 526353030 Normal WD 0.0 Pave 8 \n",
|
|||
|
"5 527105010 Normal WD 0.0 Pave 6 \n",
|
|||
|
"\n",
|
|||
|
" Total Bath Total Bsmt SF Total Porch SF Total SF \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 2.0 1080.0 272.0 2736.0 \n",
|
|||
|
"2 526350040 1.0 882.0 260.0 1778.0 \n",
|
|||
|
"3 526351010 1.5 1329.0 429.0 2658.0 \n",
|
|||
|
"4 526353030 3.5 2110.0 0.0 4220.0 \n",
|
|||
|
"5 527105010 2.5 928.0 246.0 2557.0 \n",
|
|||
|
"\n",
|
|||
|
" Total SF (box-cox-0.2) Utilities Wood Deck SF Year Built \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 19.344072 AllPub 210.0 1960 \n",
|
|||
|
"2 526350040 17.333478 AllPub 140.0 1961 \n",
|
|||
|
"3 526351010 19.203658 AllPub 393.0 1958 \n",
|
|||
|
"4 526353030 21.548042 AllPub 0.0 1968 \n",
|
|||
|
"5 527105010 19.016856 AllPub 212.0 1997 \n",
|
|||
|
"\n",
|
|||
|
" Year Remod/Add Yr Sold SalePrice SalePrice (box-cox-0) \n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1960 2010 215000.0 12.278393 \n",
|
|||
|
"2 526350040 1961 2010 105000.0 11.561716 \n",
|
|||
|
"3 526351010 1958 2010 172000.0 12.055250 \n",
|
|||
|
"4 526353030 1968 2010 244000.0 12.404924 \n",
|
|||
|
"5 527105010 1998 2010 189900.0 12.154253 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 6,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Newly created variables are collected in the *new_variables* list."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 7,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables = []"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Derived Characteristics\n",
|
|||
|
"\n",
|
|||
|
"Certain characteristics of a house are assumed to have a \"binary\" influence on the sales price. For example, the existence of a pool could be an important predictor while the exact size of the pool can be deemed not so important.\n",
|
|||
|
"\n",
|
|||
|
"The below cell creates boolean factor variables out of a set of numeric variables."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 8,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"derived_variables = {\n",
|
|||
|
" \"has 2nd Flr\": \"2nd Flr SF\",\n",
|
|||
|
" \"has Bsmt\": \"Total Bsmt SF\",\n",
|
|||
|
" \"has Fireplace\": \"Fireplaces\",\n",
|
|||
|
" \"has Garage\": \"Garage Area\",\n",
|
|||
|
" \"has Pool\": \"Pool Area\",\n",
|
|||
|
" \"has Porch\": \"Total Porch SF\",\n",
|
|||
|
"}\n",
|
|||
|
"# Factorize numeric columns.\n",
|
|||
|
"for factor_column, column in derived_variables.items():\n",
|
|||
|
" df[factor_column] = df[column].apply(lambda x: 1 if x > 0 else 0)\n",
|
|||
|
"derived_variables = list(derived_variables.keys())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 9,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.extend(derived_variables)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 10,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>has 2nd Flr</th>\n",
|
|||
|
" <th>has Bsmt</th>\n",
|
|||
|
" <th>has Fireplace</th>\n",
|
|||
|
" <th>has Garage</th>\n",
|
|||
|
" <th>has Pool</th>\n",
|
|||
|
" <th>has Porch</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" has 2nd Flr has Bsmt has Fireplace has Garage has Pool \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 1 1 1 0 \n",
|
|||
|
"2 526350040 0 1 0 1 0 \n",
|
|||
|
"3 526351010 0 1 0 1 0 \n",
|
|||
|
"4 526353030 0 1 1 1 0 \n",
|
|||
|
"5 527105010 1 1 1 1 0 \n",
|
|||
|
"\n",
|
|||
|
" has Porch \n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1 \n",
|
|||
|
"2 526350040 1 \n",
|
|||
|
"3 526351010 1 \n",
|
|||
|
"4 526353030 0 \n",
|
|||
|
"5 527105010 1 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 10,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[derived_variables].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### 2nd Floors\n",
|
|||
|
"\n",
|
|||
|
"A second floor may have a positive effect on the sales price. However, having a second floor correlates with overall living space. The individual effect is therefore not as clear as it seems in the plot below."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 11,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image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5epKenM3XqVL7//ntsNhtz584lJiaG2tpaHnzwQUwmEykpKfzSAsOLFy8mMzOTlpYWHA4HH3744S/+XOS2mEQi+f2gdQOv4NMbFgCNDlQn/aZ20f/qIQsKCrj22mtZvnw5np6erFixAoCMjAw+//xzvvjiC6Kjo1m0aBEAb775Ju+99x5ffPEFb7311ln7zs7Oxmq10q1bt/Y2Hx8flixZwlVXXcV///tfAN544w369u3L8uXLycjIoLS09Ix93njjjUyZMoXLL7/8tK8fOHCA11577VcZFpArF4lE8kciuDdc8QHkr4eQvtBtyK/uMiwsjISEBAASExMpKSkB4MiRI8ydO5fGxkaam5sZOnQoAH369OGRRx5hwoQJZGScedVUUVHBww8/zD//+U9Uqo51wNixYwFISkriu+++A2Dbtm28/vrrAIwcORJvb+8z9vvDbbEfkpaWhsFgOId3fnakcZFIJH8sekwSj05Cq9W2H6vVatra2gB45JFHePPNN+nRoweLFy9m69atADzzzDPs2bOHNWvWMH36dD7//HN8fHxO6bOpqYnbb7+d+++/n5SUlFNeO5Ehr1KpsNvtnfY+TqDX//rVHMhtMYlEIukSmpubCQgIwGq18uWXX7a3FxYWkpyczL333ouPjw/l5eWnXGexWLj77ruZMmUK48ePP6exBgwY0D7G2rVrqa+v77w38guRKxeJRCLpAu69914uv/xyfH19SU5Oprm5GYAXXniBgoICnE4ngwcPpkePHqdc980337B9+3bq6upYsmQJAP/4xz/at95Ox913382DDz7IpEmT6NOnDyEhIV33xs4RxflLwwp+Z0ybNk0WC5NIJGclJyfnrDf53zune/9nunfKbTGJRCKRdDrSuEgkEomk05HGRSKRSCSdTpcZl7y8vHb9milTptC3b1/+7//+j7q6OmbOnMnYsWOZOXNme1SD0+nk2WefJSMjg8mTJ7N///72vpYsWcLYsWMZO3Zsu4MLYN++fUyePJmMjAyeffbZ9qzUM40hkUgkkt+GLjMu0dHRLFu2jGXLlrF48WL0ej0ZGRnMmzeP1NRUMjMzSU1NZd68eQBkZWWRn59PZmYmc+bMYfbs2YAwFK+//jqfffYZC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05HGRSKRSCSdjjQuEolEIul0pHGRSCQSSacjjYtEIpH8Tnn00UdJTU1tL3nyWyKNi0QikfxOmTZtGu++++55GVsaF4lE8vOwWcHhON+z+P2R/Rm8mgSzDeLf7M9+dZcDBgzA29v718/tFyCNi0QiOXdyV8FbqfDhdDDlnO/Z/H7I/gy+vAfqiwCn+PfLezrFwJwvpHGRSCTnhs0K3/wVqo9A3mo4sOR8z+j3w6pnwPoDBWRrq2i/SJHGRSI5B8rrW9mYW0VpXcv5nsr5Q6UG7/CO57rzs93yu6S++Oe1XwRIbTGJ5CQOljVwtLKJxBBvIv3dAWFYZn2wg+ySeuIDPXjvpgGE+7qdtR+Hw4nV7sD1B0q3FzUqFYx7HvYvBp0Bel91vmf0+8E77PiW2GnaL1LkykUiOc7h8kaufmczd3+8i5v/bxslxws15VY2k11SL86paOJIRdNZ+ymobuaOD3cw+pW1fLO3rMvn/ZtiTID0x2HI3eDud75n8/th9FPg8oPaLS560f4reOCBB7jqqqs4duwYw4cPZ+HChb+qv59Dl65cGhoaeOKJJzh8+DCKovD8888TFRXF/fffT0lJCaGhocydOxdvb2+cTifPPfcca9euRafT8Y9//IPExEQAlixZwltvvQXAnXfeyWWXXQbAvn372sscjxgxgscffxxFUairqzvtGBLJ2ThW1URtixWAvKpmSmpbCTXoifJzJzbQndyKZsJ93IgOcD9rP5kHTGQeELXK//p5NoOj/fBx13b
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"has 2nd Flr\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Basements\n",
|
|||
|
"\n",
|
|||
|
"Nearly all houses in Ames, IA, have a basement. Therefore, *has Bsmt* is most likely not an important predictor."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 12,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACF20lEQVR4nO2dd3gVddqG75PeKySBEAKh94D0UDQYUHoV+8qquIoitl0roii7a19ldWV1/dy1AgooqJRQQ++RXkNCSQIhhUB65vvjSXISCEhJaP7u68rFnDlzppyEeedtz2uzLMvCYDAYDIYqxOFKn4DBYDAYrj+McTEYDAZDlWOMi8FgMBiqHGNcDAaDwVDlGONiMBgMhirH6UqfwNVCp06dCA0NvdKnYTAYDNcUhw4dYvXq1WesN8alhNDQUL7//vsrfRoGg8FwTTF06NBK15uwmMFgMBiqHGNcDAaDwVDlGONiMBgMhirH5FwMBoOhCikoKODgwYPk5uZe6VOpUtzc3KhTpw7Ozs7ntb0xLgaDwVCFHDx4EG9vb+rVq4fNZrvSp1MlWJZFWloaBw8epH79+uf1GRMWMxgMhiokNzeXwMDA68awANhsNgIDAy/IGzOei8FguD6wLNg9D47ugnrdILTtFTuV68mwlHKh12SMi8FguD5IWAZfj5SR8QqBBxeCr2mMvlKYsJjBYLg+OHFEhgUgOxlyjp9928s4xurgwYP079+/yvfZunVrBg0axMCBA7n99tvZt2/fJe939erVbNiwoQrO0BgXg8FwvVCvGzTsDQ5O0OPPUKPxmdsUFcCqj+DDzrD475B38vKfZxVRt25dZs2axQ8//MDgwYP5+OOPL3mfa9asYePGjVVwdiYsZjAYrhd8QuG2zyE3E7yCwMHxzG0Ob4RfntXy4kkQ2g4axVT7qRUVFfH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SyM/PZ86cOURHR1/SPs+GMS4Gg8FwlfFMnya4OztWWOfu7MgzfZpc0n6dnJwYP348DzzwAH379uXWW2+lUaNGl7TPsx6rWvZqMBgMhoumNK/y5tydHM7IobafO8/0aVIl+ZaePXvSs2fPS97Pb2GMi8FgMFyFDG4bes0k7yvDhMUMBoPBUOUY42IwGAyGKscYF4PBYDBUOca4GAwGg6HKMcbFYDAYDFWOMS4Gg8HwO+G5556jS5cuZSNQqhNjXAwGg+F3wtChQ/nkk08uy7GMcTEYDBdGYQEUF1/ps7j+iZ8K77aECX76N37qJe+yQ4cO+Pr6Xvq5nQfGuBgMhvNnTyx81AW+GAYp26/02Vy/xE+FH8dCZhJg6d8fx1aJgblcGONiMBjOj8IC+PkvkLYb9i2EbTOu9Bldv8S+CgWnKSAX5Gj9NYIxLgbD+ZB1CPYvhYyDV/pMrhwOjuAbZn/tdnnCK79LMs/yd3a29VchRlvMYChPylY4tgtCWkNgA63LOgTf3A2HN0DNZnDnt+Affu79FBdDUQE4u1b/OV8uHBygzyTY+j24+UHr26/0GV2/+NYpCYlVsv4awXguBkMpqdvh//rDtPvgq5H2p8Rju2VYAI5uh6M7zr2f4/th6t3wzw6w7YdqPeXLTnAziH4Buo4Bz8ArfTbXL73Gg/Nps1uc3bX+EnjyySe5/fbb2b9/Pz169GDatGmXtL9zUa2eS1ZWFi+++CK7du3CZrMxadIk6tevzxNPPMGhQ4cIDQ3lvffew9fXF8uyeP3111myZAlubm787W9/o0WLFgDMmDGDjz76CICHH36YIUOGALBly5ayMcc9e/bkhRdewGazkZGRUekxDIZzkrYHco6XLO+GjEQ9KQY0gBpN4NhO8AuHwN+Yf7Fjjn4AfngUwqPMjdhwYbS+Tf/
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"has Bsmt\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Fireplaces\n",
|
|||
|
"\n",
|
|||
|
"Bigger houses are more likely to have a fireplace. Thus, the variable *has Fireplace* might be an interesting predictor."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 13,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACV4klEQVR4nOydd3hUZfbHP1PSe530hIQeAqETAgECoYpS7Y1V+CnYy64VWFHUtbHKriur6+ra6CAi0iGE3kOHQHrvfZIp9/fHIQkgTUkE9H6eZx7u3Ln3vm9mhnvmvOec79EoiqKgoqKioqLSjGiv9wRUVFRUVH5/qMZFRUVFRaXZUY2LioqKikqzoxoXFRUVFZVmRzUuKioqKirNjv56T+BGoXfv3gQGBl7vaaioqKjcVGRnZ7Nz586f7VeNy1kCAwNZsmTJ9Z6GioqKyk3FuHHjLrpfXRZTUVFRUWl2VOOioqKiotLsqMZFRUVFRaXZUWMuKioqf3hMJhNZWVkYjcbrPZUbFnt7e4KCgrCxsbmq41XjoqKi8ocnKysLFxcXwsLC0Gg013s6NxyKolBcXExWVhatWrW6qnPUZTEVFZU/PEajES8vL9WwXAKNRoOXl9cv8uxUz0VFReX3gaLAqTVQeBLC+kFg1190umpYLs8vfX9U46KiovL7IG0LfHuHGBlnP5i8AdzUwujrhbospqKi8vugMlcMC0BVHtSWXPrYK7SxysrK4pZbbmnGyck1O3fu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Au+e
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"has Fireplace\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Garages\n",
|
|||
|
"\n",
|
|||
|
"Holding the overall living area fixed adding a garage seems to affect the price positively. Thus, *has Garage* seems like an interesting predictor as well."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 14,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACJgElEQVR4nO2dd3hUZdqH70nvlWQSQkijhxJ6CQQJhB46YlcsWFDEtnZEUda174q68um6ulY6CiIl1NB76BAghUAmvfeZ8/3xJJkEQk+o731duZg5c+oknN95uk7TNA2FQqFQKOoRi+t9AgqFQqG49VDiolAoFIp6R4mLQqFQKOodJS4KhUKhqHeUuCgUCoWi3rG63idwo9C9e3f8/Pyu92koFArFTUVKSgpbt249Z7kSl0r8/PxYsGDB9T4NhUKhuKkYM2ZMncuVW0yhUCgU9Y4SF4VCoVDUO0pcFAqFQlHvqJiLQqFQXITy8nJOnTpFSUnJ9T6V64adnR1NmjTB2tr6ktZX4qJQKBQX4dSpUzg7OxMYGIhOp7vep3PN0TSNzMxMTp06RVBQ0CVto9xiCoVCcRFKS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gUikujohyWvQyZx+DEaji48Hqf0a1BzDtQflYH5PJiWX4To8RFobgU8lLg5HrIOXW9z+T6YWEJrv7m93bXz+VyS5F7nr+p8y2/SVC9xRSKmhgOQMZR8GkPniGyLC8Ffr0PTu8Cr9Zwz2/gHnDh/ZhMYCwHa9uGP+drhYUFDJoJBxa
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"has Garage\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Pools\n",
|
|||
|
"\n",
|
|||
|
"Unfortunately, almost no one in Ames, IA, has a pool. The predictor *has Pool* seems quite uninteresting."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 15,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACf00lEQVR4nOzdd3hUddrw8e/0kkxLmUnvlRAIndClCoggYNddcZVddR+7u5a1PNbn3XXV3XWLrK6ra1kVKSooKAgBpbfQIb3PJJPMTCaZPvP+MWEAKaImIno+18VlPDNzziEJc8+v3PctCoVCIQQCgUAg6EXi830DAoFAIPjxEYKLQCAQCHqdEFwEAoFA0OuE4CIQCASCXicEF4FAIBD0Oun5voEfihEjRpCcnHy+b0MgEAguKI2NjWzZsuWU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VFQEwNKlS/n73/8OwC233MJll10GwL59+yJtjsePH89DDz2ESCTCZrOd9hoCwdlUtznp6PYBUNXWRWOHi2S9CmKyIS4f2g6DPh1iz973YvUBM6sPhPuR//b9ckZmxWKIkvf5/Qt+pAZcEf7vmsfDU2G6lHBgOXb8W3ruued64ebOrE9HLk899RRjx47lk08+Yfny5WRnZ7No0SJKS0tZvXo1paWlLFq0CICysjJqampYvXo1TzzxBI899hgANpuNF198kXfffZf33nuPF198EbvdDsBjjz3GE088werVq6mpqaGsrAzgjNcQCM6mMElHv0QNAGNz48iO75kW06fCte/C1e/A9csgNuus59Eqj39mS9IrkUl
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"has Pool\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Porch\n",
|
|||
|
"\n",
|
|||
|
"Most houses have a porch."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 16,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACNJElEQVR4nOydd3hUZdqH7ynpvU56QqghQEIvoUgwICDSxa5YsKDYV7Ega1vX7urqyurnumsHaYIKEkoA6S10AiQhCWTSe5853x9PkgkYECSh+d7XlYszZ86c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AVfubzWK1gqQU7h9af84VCr4cRr8Le+eDoCd1uuNgzujLxCKl3iTWz/zJCrVwUigZy9sN/roW5d8BXU2xPinkpYlgAcvdD7oEzn6cgFb67Bf7ZG/YtbtUpX3BMURD/LAyYDi4+F3s2VybDZoHdKb1b7Jxk/3nw2GOPccMNN5CamsrgwYOZO3fueZ3v92jVlUtJSQnPPfcchw4dQqfT8eqrr9KmTRseffRRsrKyCA4O5t1338XDwwNN03jllVdYs2YNjo6OvPbaa0RHRwOwYMECPvroIwDuv/9+xo8fD8CePXsa2xwPGTKEZ599Fp1OR1FRUbNjKBRnJP8wVBbUb6dA0TF5WvRuC74dIe8geIaDz+/0wDiwVH4AFj8I4XHqRqw4e7pdL/8mvigPOB4hYlga9v9B3n777RaY3NnTqiuXV155hUGDBvHzzz+zaNEi2rZty5w5c+jfvz/Lly+
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"has Porch\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Neighborhoods\n",
|
|||
|
"\n",
|
|||
|
"The instructors' notes say:\n",
|
|||
|
"\n",
|
|||
|
"> For instructors who cover nominal variables in their class, I would suggest incorporating the neighborhood variable into their models by converting it to a set of dummy (indicator) variables. I have found that the coefficients for the continuous variables tend to have values with more realistic interpretations when used in conjunction with the neighborhood variable.\n",
|
|||
|
"\n",
|
|||
|
"Indeed, plotting the price distributions by neighborhood reveals significant differences in the price level."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 17,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
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hrbo6OjRbNmzUSTJk3Etm3b8u2XmpoqPvroI9GkSRPh7e1d4HnHjRuXb1819d/sjTfeEPfu3cu3PSAgQDRp0kS0aNEi3/vsyy+/FE2aNBH9+vUT2dnZ+fZdtmyZaNKkiWjdurVITk6W1qekpIi33npLNGnSRCxdujTfftnZ2eKLL74QTZo0EXK5XGPbuXPnpOd16tSpfPveu3dPtGjRQjRp0kR07NixwOdNZCysGBKVMCEEHjx4gN9//x1LliwBANStWxcdO3bM99gPP/wQTZo0KfY51LevPvjgA51v3wYGBiI1NRXt2rVDs2bNtD7mzTffxCuvvILExESNNlLVq1cHkNuJxtgGDx4Ma2trrettbGyQkpKCEydOSOutra3h4eEBAFqrq+pq4XvvvYd69eoZFFu9evXQq1cvALltDUUB7S/zMuR1Lkh8fLxUeRoyZAhkMlm+x3zzzTdFHsfGxgaDBg3Kt75y5cr44IMPAKDQtptDhw7Veu7hw4cDAKKionDjxg1p/ZEjR6BSqeDo6Ig+ffrk269KlSoYMmQIgNzhgXJycrSe9+uvvy7kWeXq3Lkz6tevn2+9q6srZDIZMjMzcf/+fWl9QkICzpw5AwAYNmxYvlvFQO5ramNjg9TUVBw7dkxaf/LkSaSkpMDKykqKP69KlSph5MiRAHLbmeb93Kh7nbdu3Rrvv/9+vn3r16+Pjz/+uMjnS2QsTAyJSsDZs2elTgPNmjVDp06dsHjxYqSnp8PR0RG//PKL1uTnzTff1Ot8V65cAQB06NB
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 720x576 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"_, ax = plt.subplots(figsize=(10, 8))\n",
|
|||
|
"sns.boxplot(x=\"Neighborhood\", y=\"SalePrice\", data=df, ax=ax)\n",
|
|||
|
"ax.set_title(\"Prices by Neighborhood\", fontsize=24)\n",
|
|||
|
"ax.set_xlabel(\"Neighborhood\", fontsize=18)\n",
|
|||
|
"ax.set_xticklabels(ax.get_xticklabels(), rotation=45)\n",
|
|||
|
"ax.set_ylabel(\"House Price\", fontsize=18);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"The 28 neighborhoods are encoded as factor variables."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 18,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"neighborhood = pd.get_dummies(df[\"Neighborhood\"], prefix=\"nhood\")\n",
|
|||
|
"df = pd.concat([df, neighborhood], axis=1)\n",
|
|||
|
"del df[\"Neighborhood\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 19,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.extend(neighborhood.columns)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"(2898, 28)"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 20,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[neighborhood.columns].shape"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 21,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>nhood_Blmngtn</th>\n",
|
|||
|
" <th>nhood_Blueste</th>\n",
|
|||
|
" <th>nhood_BrDale</th>\n",
|
|||
|
" <th>nhood_BrkSide</th>\n",
|
|||
|
" <th>nhood_ClearCr</th>\n",
|
|||
|
" <th>nhood_CollgCr</th>\n",
|
|||
|
" <th>nhood_Crawfor</th>\n",
|
|||
|
" <th>nhood_Edwards</th>\n",
|
|||
|
" <th>nhood_Gilbert</th>\n",
|
|||
|
" <th>nhood_Greens</th>\n",
|
|||
|
" <th>nhood_GrnHill</th>\n",
|
|||
|
" <th>nhood_IDOTRR</th>\n",
|
|||
|
" <th>nhood_Landmrk</th>\n",
|
|||
|
" <th>nhood_MeadowV</th>\n",
|
|||
|
" <th>nhood_Mitchel</th>\n",
|
|||
|
" <th>nhood_Names</th>\n",
|
|||
|
" <th>nhood_NoRidge</th>\n",
|
|||
|
" <th>nhood_NPkVill</th>\n",
|
|||
|
" <th>nhood_NridgHt</th>\n",
|
|||
|
" <th>nhood_NWAmes</th>\n",
|
|||
|
" <th>nhood_OldTown</th>\n",
|
|||
|
" <th>nhood_SWISU</th>\n",
|
|||
|
" <th>nhood_Sawyer</th>\n",
|
|||
|
" <th>nhood_SawyerW</th>\n",
|
|||
|
" <th>nhood_Somerst</th>\n",
|
|||
|
" <th>nhood_StoneBr</th>\n",
|
|||
|
" <th>nhood_Timber</th>\n",
|
|||
|
" <th>nhood_Veenker</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" nhood_Blmngtn nhood_Blueste nhood_BrDale nhood_BrkSide \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_ClearCr nhood_CollgCr nhood_Crawfor nhood_Edwards \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_Gilbert nhood_Greens nhood_GrnHill nhood_IDOTRR \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 1 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_Landmrk nhood_MeadowV nhood_Mitchel nhood_Names \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 1 \n",
|
|||
|
"2 526350040 0 0 0 1 \n",
|
|||
|
"3 526351010 0 0 0 1 \n",
|
|||
|
"4 526353030 0 0 0 1 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_NoRidge nhood_NPkVill nhood_NridgHt nhood_NWAmes \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_OldTown nhood_SWISU nhood_Sawyer nhood_SawyerW \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_Somerst nhood_StoneBr nhood_Timber nhood_Veenker \n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 21,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[neighborhood.columns].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Nominal Features\n",
|
|||
|
"\n",
|
|||
|
"This section investigates the rest of the nominal variables with regard to which realizations / encoding might be a useful predictor."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 22,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Alley Type of alley access to property\n",
|
|||
|
"Bldg Type Type of dwelling\n",
|
|||
|
"Central Air Central air conditioning\n",
|
|||
|
"Condition 1 Proximity to various conditions\n",
|
|||
|
"Condition 2 Proximity to various conditions (if more than one is present)\n",
|
|||
|
"Exterior 1st Exterior covering on house\n",
|
|||
|
"Exterior 2nd Exterior covering on house (if more than one material)\n",
|
|||
|
"Foundation Type of foundation\n",
|
|||
|
"Garage Type Garage location\n",
|
|||
|
"Heating Type of heating\n",
|
|||
|
"House Style Style of dwelling\n",
|
|||
|
"Land Contour Flatness of the property\n",
|
|||
|
"Lot Config Lot configuration\n",
|
|||
|
"MS SubClass Identifies the type of dwelling involved in the sale.\n",
|
|||
|
"MS Zoning Identifies the general zoning classification of the sale.\n",
|
|||
|
"Mas Vnr Type Masonry veneer type\n",
|
|||
|
"Misc Feature Miscellaneous feature not covered in other categories\n",
|
|||
|
"Roof Matl Roof material\n",
|
|||
|
"Roof Style Type of roof\n",
|
|||
|
"Sale Condition Condition of sale\n",
|
|||
|
"Sale Type Type of sale\n",
|
|||
|
"Street Type of road access to property\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"print_column_list(set(NOMINAL_VARIABLES) - set([\"Neighborhood\"]))"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Alleys\n",
|
|||
|
"\n",
|
|||
|
"Almost no house has access to an alley."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 23,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACl2klEQVR4nOzdd3iT5frA8W/SJG26d7p3yyiFUmahUCi07I2KGzyKR3ArjiOOo6jnuEX0KA6cqGwZMltW2aOslrZ073SmaTqyf3/kR7CypQXR93NdXrZv3rzP06T0zvuM+xaZzWYzAoFAIBB0IPGN7oBAIBAI/nqE4CIQCASCDicEF4FAIBB0OCG4CAQCgaDDCcFFIBAIBB1OcqM78GcxYMAA/P39b3Q3BAKB4KZSXl7OgQMHzjsuBJf/5+/vz6pVq250NwQCgeCmMnXq1AseF4bFBAKBQNDhhOAiEAgEgg4nBBeBQCAQdDhhzkUgEAj+IL1eT1lZGW1tbTe6K53Ozs6OgIAApFLpFZ0vBBeBQCD4g8rKynByciIkJASRSHSju9NpzGYzdXV1lJWVERoaekXPEYbFBAKB4A9qa2vDw8PjLx1YAEQiER4eHld1hybcuQgEgr8Es9nM7rLdFDYW0tenL9Ge0del3b96YDnran9OIbgIBIK/hENVh3g47WHMmPGSe7F03FJ8HHxudLf+toRhMYFA8JdQ3VKNGUt5qprWGhq1jRc9989axmrbtm106dKF/Px8wDKnM378eAAOHDjAgw8+eCO7d1WE4CIQCP4S+vn0Y4j/ECQiCQ/2fJBQl/MnnvUmPT9k/cCU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"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Alley\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 24,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Alley\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Building Type\n",
|
|||
|
"\n",
|
|||
|
"The type of a building clearly affects the valuation. The two types of townhouses as well as the 2-family condo and duplex type are summarized into a single category. This makes sense a) semantically, and b) by looking at the two sub-clusters in the scatter plot."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 25,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACr3ElEQVR4nOydd3iUVfbHP9NnkkySSZlJJb2REHoJXXoRQYq9wNrL2ntB17ara1t115+sva6CFBEVFJCA9BoCoaT3TOpMptffHwMDSEBKAqLv53l8nNz3vvfemZA5773nnO8Reb1eLwICAgICAp2I+HwvQEBAQEDgj4dgXAQEBAQEOh3BuAgICAgIdDqCcREQEBAQ6HQE4yIgICAg0OlIz/cCfi8MHDiQ2NjY870MAQEBgQuKmpoaNm3adFy7YFwOERsby8KFC8/3MgQEBAQuKKZPn95hu3AsJiAgICDQ6QjGRUB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IiAgICDQ6QjGRUBAQECg0xGMi4CAgIBApyMYFwEBAQGBTkcwLgICAgICnY4QLSYgICBwHqirq+Ohhx6iubkZkUjEZZddxvXXX3/WkvsFBQW8+OKLNDU1oVKpyM7O5oknnkCl6vqEz6MRjIuAgIDAeUAikfDII4+QnZ2NyWRixowZDBkyBDhzyf2mpibuvvtuXn31VXr37g3ADz/8gNlsFoyLgIDA7xuny4NELEIs/pPVSSr4ClY+A4ZqCImD0XMh97IzHk6r1fpFJoOCgkhOTvYXPOyI3r1
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Bldg Type\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 26,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"# Unify the two townhouse types into one.\n",
|
|||
|
"df[\"Bldg Type\"] = df[\"Bldg Type\"].apply(\n",
|
|||
|
" lambda x: \"Twnhs\" if x in (\"TwnhsE\", \"TwnhsI\") else x\n",
|
|||
|
")\n",
|
|||
|
"# Unify the two kinds of 2-family homes.\n",
|
|||
|
"df[\"Bldg Type\"] = df[\"Bldg Type\"].apply(\n",
|
|||
|
" lambda x: \"2Fam\" if x in (\"2FmCon\", \"Duplx\") else x\n",
|
|||
|
")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 27,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"build_type = pd.get_dummies(df[\"Bldg Type\"], prefix=\"build_type\")\n",
|
|||
|
"df = pd.concat([df, build_type], axis=1)\n",
|
|||
|
"del df[\"Bldg Type\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 28,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.extend(build_type.columns)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 29,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>build_type_1Fam</th>\n",
|
|||
|
" <th>build_type_2Fam</th>\n",
|
|||
|
" <th>build_type_Twnhs</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" build_type_1Fam build_type_2Fam build_type_Twnhs\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1 0 0\n",
|
|||
|
"2 526350040 1 0 0\n",
|
|||
|
"3 526351010 1 0 0\n",
|
|||
|
"4 526353030 1 0 0\n",
|
|||
|
"5 527105010 1 0 0"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 29,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[build_type.columns].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Air Conditioning\n",
|
|||
|
"\n",
|
|||
|
"Air conditioning clearly increases the valuation (\"steeper\" regression line with respect to the overall living area)."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 30,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACKh0lEQVR4nO2dd1hUZ9qH76H3KgxVEMSGBXvBkqBg7xpjupvETWJiTNtNVVN3N724yRfTNrtpxp5ojAUr9o5dUVFAGHrvM+f74wEGFbGB9b2vi8szZ04d8Pzm6TpN0zQUCoVCoWhALK73BSgUCoXi1kOJi0KhUCgaHCUuCoVCoWhwlLgoFAqFosFR4qJQKBSKBsfqel/AjUL37t3x9/e/3pehUCgUNxUpKSls3br1vPVKXKrw9/dnwYIF1/syFAqF4qZizJgxda5XbjGFQqFQNDhKXBQKhULR4ChxUSgUCkWDo2IuCoVCcZlUVFSQnJxMaWnp9b6Ua4adnR0BAQFYW1tf0vZKXBQKheIySU5OxtnZmeDgYHQ63fW+nEZH0zSysrJITk6mWbNml7SPcospFArFZVJaWoqnp+dtISwAOp0OT0/Py7LUlOWiUChuDTQNjq2AjKMQ3Bv8Ozbq6W4XYanmcu9XiYtCobg1SNwAP08QkXHygUdXg6sqjL5eKLeYQqG4NShIFWEBKEyDkuwLb9sIY6wyMjJ45plnGDBgAGPGjOHRRx/l5MmTV3SsBQsWYDAYLnu/zz77jG+++eaC748cOZJnnnnmrHWffPIJmzZtuuxzXQwlLgqF4tYguDc0jwELK+j7N2jS4vxtjBWw5Qv4vAes/ReUFTXIqTVN48knn6Rbt26sWrWKBQsW8Nxzz5GVlXVFx1u4cCHp6el1vmc0Gq/omMePH8dkMrFjxw6Ki4tr1j/99NP06tWrwc5TjXKLKRSKWwMXf7jreyjNAydvsLA8f5szu+HPF2V57Tvg3wnCoq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RKXBQKheI688LAlthbnz2a2d7akhcGtmywc/zlL38hJyenwY53MdQ8F4VCobjOjOroD0js5UxuCX5u9rwwsGXN+itl9+7dNctNmjRh7969V3W8y0GJi0KhUNwAjOrof9ViciOh3GIKhUKhaHCUuCgUCoWiwVHiolAoFIoGR4mLQqFQKBocJS4KhUKhaHCUuCgUCsUtiKZpTJw4kXXr1tWsW7ZsGQ8//PA1Ob8SF4VCobgF0el0vP766/zzn/+krKyMoqIiPvroowu22WpoVJ2LQqG4PCorwMISLNR30wYl/leIfQPyksE1APpPh/Z3XdUhW7RowZ133slXX31FcXExI0eOpGnTpg10wfWjxEWhUFw6CbGw7O/gGggD3wF96+t9RbcG8b/C71OhoqpRZV6SvIarFpgnn3yS0aNHY2Njw/z586/yQi8dJS4KheLSqKwQYck6Jj8HFypxaShi3zALSzUVJbL+KsXFwcGBIUOG4ODggI2NzVUd63JQdq1CcSnkp8DJ9ZCbfL2v5PphYSkWSzV2rtfvWm418i7wd3Wh9ZeJhYUFFtfYjaksF4WiNoYDkHkUfNqDZ6isy0+BX+6DM7vAqzXcMwfcg+o/jskExgqwtm38a75WWFiIK+zAArBzg/Z3X+8runVwDRBXWF3rb1KU5aJQVJN+CP4zDOY+BD9NMH9rzDwmwgKQcQgyDtd/nOyT8Ot98O+ucPC3Rr3ka46+NUS9Ar2mgKPn9b6aW4f+08H6nNkt1vay/ialUcUlPz+fqVOnMmjQIAYPHszu3bvJzc1l0qRJxMTEMGnSJPLy8gDJyX7rrbeIjo5m+PDhHDhwoOY4CxcuJCYmhpiYGBYuXFizfv/+/QwfPpzo6GjeeustNE0
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Central Air\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Use a new variable name to cleary show that the variable's *dtype* is changed from *str* to *int*."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 31,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"air_cond\"] = df[\"Central Air\"].apply(lambda x: 1 if x == \"Y\" else 0).astype(int)\n",
|
|||
|
"del df[\"Central Air\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 32,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.append(\"air_cond\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 33,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>air_cond</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" air_cond\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1\n",
|
|||
|
"2 526350040 1\n",
|
|||
|
"3 526351010 1\n",
|
|||
|
"4 526353030 1\n",
|
|||
|
"5 527105010 1"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 33,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"air_cond\"]].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### \"Proximity to various Conditions\"\n",
|
|||
|
"\n",
|
|||
|
"The columns *Condition 1* and *Condition 2* have the same realizations and can be regarded as \"tags\" given to a house indicating the nearby presence of a) a major street, b) a railroad, or c) a park.\n",
|
|||
|
"\n",
|
|||
|
"The default tag \"Norm\" (implying no \"condition\") is given to 86% of the houses (this realization should therefore not be regarded as a tag!).\n",
|
|||
|
"\n",
|
|||
|
"From the comparison of the grouped scatter plots below, it can be assumed that the proximity of a major street decreases the valuation (lower regression slope through the cloud of blue and orange dots). Therefore, a factor variable *major_street* is extracted indicating the proximity of an \"artery\" or \"feeder\" street.\n",
|
|||
|
"\n",
|
|||
|
"Further, a factor variable *railway* is extracted as a relatively high proportion of the houses has such a tag. From the plots, a railway seems to not affect the valuations strongly.\n",
|
|||
|
"\n",
|
|||
|
"Lastly, a factor variable *park* is extracted. From the plots, this does not seem to affect the valuation much."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"List the \"raw\" realizations:"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 34,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Feedr 174\n",
|
|||
|
"Artery 97\n",
|
|||
|
"RRAn 48\n",
|
|||
|
"PosN 43\n",
|
|||
|
"RRAe 29\n",
|
|||
|
"PosA 24\n",
|
|||
|
"RRNn 11\n",
|
|||
|
"RRNe 6\n",
|
|||
|
"dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 34,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"(\n",
|
|||
|
" (\n",
|
|||
|
" df[\"Condition 1\"].value_counts() + df[\"Condition 2\"].value_counts()\n",
|
|||
|
" )\n",
|
|||
|
" .sort_values(ascending=False)[1:]\n",
|
|||
|
")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 35,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"# Condition 2 is only filled with anything other than \"Norm\"\n",
|
|||
|
"# if Condition 1 already has such a tag.\n",
|
|||
|
"assert not ((df[\"Condition 1\"] == \"Norm\") & (df[\"Condition 2\"] != \"Norm\")).any()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 36,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"86"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 36,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"# 86% of the houses actually have no tag.\n",
|
|||
|
"round(100* (df[\"Condition 1\"] == \"Norm\").sum() / df.shape[0])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"From a simple scatter plot it is hard to see any significant impact by a predictor."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 37,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAC0jklEQVR4nOydd3hU1daH35nJJJnUSe+9QAiBEEIvgUACAqGrqFcFCwooFsSGHRQ7KNi4Koid3iI19BZaKGkkpJA+qZOeybTvj/kYjAQIkIhcz/s8Ps7sc87ea86EWWfvvdZvifR6vR4BAQEBAYF2RHy7DRAQEBAQ+N9DcC4CAgICAu2O4FwEBAQEBNodwbkICAgICLQ7gnMREBAQEGh3T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ddf4+/vz8SJE2/a1j8jZOgLCAgItBPu8tYrW16tvS1s376dcePGsWfPHnbv3s2+ffvw9PRsURAMrpTkHzhwIGvXrjW2KRSKq0bOdu/enZKSErZs2WKM7L1VBOciICAg0E7MHdEJmbRliWWZVMLcETe/zLRlyxaGDx/eoi02NvaKqDE7OzsiIiIYM2YMH3zwAQMHDmTMmDFMmTKFuLg4Zs+e3aqU/yXuuusuIiIisLW1vWlb/4wguf//CJL7AgICrXGjkvsdES32d/DEE08wdepU+vXrd9VzbkRyXygWJiAgINCOjO/hcUc4k0vU1NRw991306lTp2s6lhtFcC4CAgIC/2JsbGzYvn17u/cr7LkICAgICLQ7gnMREBAQEGh3BOciICAgINDuCM5FQEB
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Condition 1\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"However, plotting the groups seperately reveals different slopes."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 38,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABasAAARKCAYAAABB6CxvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3yUZbrG8d87M5n0QgkJgQCCSkTBgiwgiIpGLKAIKurqrm1ZFXUta0SDHRSjru6qR2Qta1sbTRQVkGpAqiIIZhVpgTRa2qRMe88f4wwJKSSQZCjX93z8cDJvu5OwT8KVO/djmKZpIiIiIiIiIiIiIiISRJZgFyAiIiIiIiIiIiIiorBaRERERERERERERIJOYbWIiIiIiIiIiIiIBJ3CahEREREREREREREJOoXVIiIiIiIiIiIiIhJ0CqtFREREREREREREJOgUVssxY/DgwQwePLjaa9OmTaN79+5MmzatUffq3r07N9xwQ1OWJyJyxNG6KiLSsrTuSmO8/PLLdO/eneXLlwe7FJEjhtZZkeCzBbsAOXL99ttv/Pe//2X58uXk5uZSWVlJXFwcPXr0IDU1lcsvvxy73R7sMg+K/4vT/Pnzg1xJw3399desXLmSn3/+maysLBwOB8OGDeP5558PdmnV3HDDDaxYsQKLxcKMGTPo3r17jXPGjh3L9OnTefvttznrrLOCUKVIcGhdPbwcKetqVatXr+a6664D4Mknn2TUqFEHfa8j8XMm0lhadw8vR8q66/9+ti5XXHEFEydObMGKRA5fWmcPL0fyOhsREUGnTp1ITU3lpptuIjIyssZ1gwcPZseOHYG3DcMgMjKSbt26cckll/DHP/6RkJCQGtf5c4mkpCS+/vprQkND67z3+vXrsdkUpzYnfXTloLzyyiu8+uqreL1eTj/9dK644goiIiLYtWsXK1asYNy4cXz44YeN/sljS0tNTeXUU0+lXbt2jbruyy+/JDw8vJmqOjivvfYaWVlZREREkJiYyKZNm4JdUr28Xi8ZGRm8+eabwS5F5LCgdVXralP45JNPAN835h9//PEhhdUiRzutu1p3D9UVV1xBhw4darx+0kknBaEakcOP1lmts4fKv86apklBQQHffPMNL7/8MvPnz+ejjz6q8wcdf/rTn4iJicHj8ZCbm8ucOXN45plnWLZsGZMmTarzeTk5ObzzzjuMHj26ud4laQCF1dJokyZN4uWXX6Z9+/b885//5NRTT61xzoIFC3jrrbeCUF3jREdHEx0d3ejrunXr1gzVHJqHHnqIxMREOnfuzIoVK/jTn/4U7JLq1blzZzIzM1myZAkDBgwIdjkiQaV1VetqUyguLubrr7+mS5cudO/endmzZ7NhwwZ69OgR7NJEDjtad7XuNoUrrriCvn37BrsMkcOS1lmts01h/3X2/vvv57LLLmP9+vXMmjWLK664otbr/vznP9OxY8fA23fccQfDhw9nwYIFrFixgj/84Q81romNjcUwDCZPnsyVV15J69atm/4dkgbRzGpplO3bt/PKK68QEhLC5MmTa/2CA3DeeefV2jH75Zdf8sc//pHevXvTq1cvhg0bxuuvv47T6axxrn9WVFlZGc8++yznnnsup5xyCqmpqUyePBnTNGtcY5om77//Ppdeeik9e/bk7LPP5sknn6SkpKTWOvefPbV8+XK6d+/Ojh072LFjB927dw/8N3bs2MB1dc2eKikp4YUXXmDIkCH07NmTPn36cMstt7B06dIa5/qf9fLLL/Pzzz8zevRozjzzTE499VSuv/56vv/++1prrku/fv3o0qULhmE06rpguffeezEMg4yMDLxeb4Ov++mnn7jrrrvo378/p5xyCueddx6PP/44BQUFNc4dO3Ys3bt3Jzs7m/fee49hw4bRq1evwOeu6vH333+fSy65hJ49ezJ48GAmTZoU+Dv21VdfceWVV3LaaafRv39/nnzySSoqKprmAyHHPK2rPlpXD93MmTOpqKjgiiuuCHzj/vHHH9d6btWP1dq1axk9ejR/+MMfAp+7hnzOwPervWPHjuWcc87hlFNO4ayzzuL++++vtUunvjX522+/pXv37jz00EO11ut0Ounbty99+/at9e+2SGNo3fXRutsy3G43H3zwAVdffTVnnHEGp556KsOHD+f999+v83vgH3/8kbvvvpsBAwZwyimncM455/Doo4+Sn59f6/k//fQTt9xyC6effjpnnHEGN954Iz/88EOdNfk/9zt37iQ9PZ2zzz6bk0466bDvbpUjh9ZZH62zTa9Vq1ZccMEFAKxbt67B13Xu3Jk+ffrUe11YWBi33347JSUlvPrqqw267/bt2wOf9+3bt3PvvffSt29fevbsyYgRI1iwYEGDa5R91FktjTJt2jRcLheXXnopJ554Yr3n7v/rGP/4xz94/fXXadWqFUOHDiUiIoJvv/2Wf/zjH2RmZvLmm2/WuMblcnHLLbdQUFDAoEGDsFqtfPPNN7zwwgs4nU7uvPPOaudPmDCB9957j/j4eEaN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+TSSy8NfI5r43A4GDt2LB6Ph/fee48zzzwzcGzy5Mm88MILPPbYY7X+Gtn69euZPn16rUG2//jMmTNJSEgAfJ/31NRU3nzzTcLCwpg2bVrgV7icTifDhw9n6tSp3H333fqmXg6Z1tW6aV1t+Lq6Zs0a/ve//zFw4EASExMBGDZsGG+99RazZs3iqquuqvW6zMxMnnjiiRr/KDrjjDPq/ZwVFRVx//33ExYWxgcffMDxxx8fOPbLL78watQoxo0bF7hHVXWtyddccw0ZGRl89tlnXH/99dWO+WdxX3311Qf6UIgckNbdumndbdz3s9OnT691o0X/x3zSpElkZmZy/fXX8/DDDwcaJjweD4888ghTp05lyJAhgS7BzZs38/jjj9OhQwfef//9wPemAN999x0333wzEyZMCHT8mab
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1440x1080 with 9 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"street = [\"Artery\", \"Feedr\"]\n",
|
|||
|
"railway = [\"RRNn\", \"RRAn\", \"RRNe\", \"RRAe\"]\n",
|
|||
|
"park = [\"PosA\", \"PosN\"]\n",
|
|||
|
"plot = sns.lmplot(\n",
|
|||
|
" x=\"Gr Liv Area\", y=\"SalePrice\", col=\"Condition 1\", hue=\"Condition 1\",\n",
|
|||
|
" col_order=[\"Norm\"] + street + railway + park,\n",
|
|||
|
" data=df, robust=True, col_wrap=4, ci=None, truncate=True, scatter_kws={\"s\": 15},\n",
|
|||
|
")\n",
|
|||
|
"# Adjust font sizes.\n",
|
|||
|
"for ax in plot.axes:\n",
|
|||
|
" ax.set_title(ax.get_title(), fontsize=20)\n",
|
|||
|
" ax.set_xlabel(ax.get_xlabel(), fontsize=16)\n",
|
|||
|
" ax.set_ylabel(ax.get_ylabel(), fontsize=16)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Extract factor variables *major_street*, *railway*, and *park*."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 39,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"major_street\"] = 0\n",
|
|||
|
"df.loc[\n",
|
|||
|
" df[\"Condition 1\"].isin(street) | df[\"Condition 2\"].isin(street),\n",
|
|||
|
" \"major_street\",\n",
|
|||
|
"] = 1"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 40,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"railway\"] = 0\n",
|
|||
|
"df.loc[\n",
|
|||
|
" df[\"Condition 1\"].isin(railway) | df[\"Condition 2\"].isin(railway),\n",
|
|||
|
" \"railway\",\n",
|
|||
|
"] = 1"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 41,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"park\"] = 0\n",
|
|||
|
"df.loc[\n",
|
|||
|
" df[\"Condition 1\"].isin(park) | df[\"Condition 2\"].isin(park),\n",
|
|||
|
" \"park\",\n",
|
|||
|
"] = 1"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 42,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Condition 1\"]\n",
|
|||
|
"del df[\"Condition 2\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 43,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.extend([\"major_street\", \"railway\", \"park\"])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Show summary of counts:"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 44,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"major_street 264\n",
|
|||
|
"railway 94\n",
|
|||
|
"park 60\n",
|
|||
|
"dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 44,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"major_street\", \"railway\", \"park\"]].sum()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 45,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>major_street</th>\n",
|
|||
|
" <th>railway</th>\n",
|
|||
|
" <th>park</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" major_street railway park\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0\n",
|
|||
|
"2 526350040 1 0 0\n",
|
|||
|
"3 526351010 0 0 0\n",
|
|||
|
"4 526353030 0 0 0\n",
|
|||
|
"5 527105010 0 0 0"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 45,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"major_street\", \"railway\", \"park\"]].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Exterior\n",
|
|||
|
"\n",
|
|||
|
"This dimensions tells the main material with which the houses are made of. The category is too diverse and the various grouped scatter plots did not reveal differing slopes. For simplicity, this variable is dropped.\n",
|
|||
|
"\n",
|
|||
|
"This variable actually also represents tags that could be associated with a house (possibly up to two different tags)."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 46,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEkCAYAAADjOHzWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADNlUlEQVR4nOydd3hUVfrHP7dMTa+TCiQQei9CqIoC0gQEdO29+2Mta2+sKJa1iwVXXXUtawWkCYJKB+m9k0DqpGeSTL/3/v4YGIgkMUCC7X6eh+eZOTntDjP3vee87/m+gqZpGjo6Ojo6Ok2I+FtPQEdHR0fnz4duXHR0dHR0mhzduOjo6OjoNDm6cdHR0dHRaXJ046Kjo6Oj0+ToxkVHR0dHp8mRf+sJ/F7o27cvycnJv/U0dHR0dP5Q5OXlsW7dupPKdeNylOTkZL755pvfeho6Ojo6fyguvvjiOsv1bTEdHR0dnSZHNy46Ojo6Ok2Oblx0dHR0dJoc3eeio6Pzp8Tn85Gbm4vb7f6tp/KnwGw2k5KSgsFgaFR93bjo6Oj8KcnNzSUsLIxWrVohCMJvPZ0/NJqmUVpaSm5uLmlpaY1qo2+L6ejo/GlweKvIrs7BrXhwu93ExMTohqUJEASBmJiYU1oF6is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pVNnz4cB588EGsViuyLGO1WoM57a1WK9u2beOtt94iOjqaV155BYA5c+bwzDPPYDabkSSJF1544bT9JU8//TSPPvoooijSp0+f4JZcc6BL7h9
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Exterior 1st\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 47,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEkCAYAAADjOHzWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADNvUlEQVR4nOydd3gU1frHP1O2JpuebDok9N6F0EXpIKDYK/Z2+V312htXFMu1iwWv/V71KiogRUFQaQLSIXQIgfSebJLNtpn5/bGwIZJAgAQs83kenid7duacM8vuvPOe9z3fV9A0TUNHR0dHR6cJEc/1BHR0dHR0/nzoxkVHR0dHp8nRjYuOjo6OTpOjGxcdHR0dnSZHNy46Ojo6Ok2Oblx0dHR0dJoc+VxP4PdC3759SUhIONfT0NHR0flDkZOTw7p1645r143LERISEvjmm2/O9TR0dHR0/lBcfPHF9bbry2I6Ojo6Ok2Oblx0dHR0dJoc3bjo6Ojo6DQ5esxFR0fnT4nX6yU7OxuXy3Wup/KnwGw2k5iYiMFgaNTxunHR0dH5U5KdnY3NZqNly5YIgnCup/OHRtM0SkpKyM7OJiUlpVHn6MtiOjo6fxocnkoyq7JwKW5cLheRkZG6YWkCBEEgMjLylLxA3X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detWABYtWnTa19YYdMl9HR2dvzzymMH+mMuxS2MGGXnM4NPuc8GCBdxyyy112kaMGMFDDz2E1WpFlmWsVivPP/884F/p2bZtG2+
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Exterior 2nd\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 48,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Exterior 1st\"]\n",
|
|||
|
"del df[\"Exterior 2nd\"]\n",
|
|||
|
"# Also discard the associated ordinal variables.\n",
|
|||
|
"del df[\"Exter Cond\"]\n",
|
|||
|
"del df[\"Exter Qual\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Foundation\n",
|
|||
|
"\n",
|
|||
|
"The type of foundation appears to have an effect. However, only three of the six realizations occur in a large number. Factor variables *found_BrkTil*, *found_CBlock*, and *found_PConc* are extracted but not regarded as \"interesting\"."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 49,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACuF0lEQVR4nOzdd3iTVfvA8W+SJk0605nu3U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m3F+TlM//tpyhoLIBD6WCqYPb3NF8y1/VraTcF65cBAKB4A6NjPT8RwaTOyHMuQgEAoGgxQnBRSAQCAQtTgguAoFAIGhxQnARCAQCQYsTgotAIBAIWpwQXAQCgeAvqKSkhClTpjBgwABGjx7NU089RVZWFuHh4YwYMYLhw4czbtw4MjMzAVNCy2eeeea2+oqMjGzJoQPCUmSBQCD4yzEajUyaNImRI0fyySefAJCWlkZZWRk+Pj7mnGNLly7lm2++4YMPPribw70q4cpFIBDcEq1ei8FouNvD+GtJXgaftIe3lab/Jy+7o+YOHDiAhYUFDzzwgPlY27ZtmxVIhOap+C9XWVnJxIkTiY+P57777iMtLQ2Auro6pk+fTnx8PPHx8c2yKoMpAeb999/Pzp0772j8IFy5CASCW7A3fy8fHPoAN2s3pnWZRpDDXyNJ4l2VvAzWTwbthUSVVbmm7wHC77utJtPT0wkLC7vqY+fPn2fEiBHU1dXR2NjIsmVXBrLPP/+cdu3a8eWXX7J//35effVV1q5dy5dffomNjY05/1hVVZX5OaWlpTz77LO8+OKL9OzZ87bGfTnhykUgENwUrV7LB4c
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Foundation\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 50,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"PConc 1282\n",
|
|||
|
"CBlock 1242\n",
|
|||
|
"BrkTil 310\n",
|
|||
|
"Slab 48\n",
|
|||
|
"Stone 11\n",
|
|||
|
"Wood 5\n",
|
|||
|
"Name: Foundation, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 50,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[\"Foundation\"].value_counts()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 51,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABFEAAAF6CAYAAADRSsf1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAADe1ElEQVR4nOzdd3xV9f3H8de5K5tAgCREhuIgoiiKKAoCYhEFtAju0brrrqNSK1qxAq1x1lIHP2e1bgQtWFGRjQxRBKFxQTBABhCybpI7z++P470kZN2EJDfA++nDxpx7z/l+7yU9ST58hmGapomIiIiIiIiIiDTIFu0NiIiIiIiIiIjsDxREERERERERERGJgIIoIiIiIiIiIiIRUBBFRERERERERCQCCqKIiIiIiIiIiERAQRQRERERERERkQgoiCICvP/++/Tp04f333+/Vde599576dOnD1u3bm3VdURE2gPdWw8MI0aMYMSIEW223tatW+nTpw/33ntvm60pcqDR/Xf/8o9//IM+ffqwcuXKFr92ffdU/dk1nyPaG5D9R58+fRp8/K9//Svjx49vo920T//4xz+YPn06//rXvzjllFOivZ2oC70f1cXExNCtWzdOO+00fve735Genl7rPK/XywcffMCnn37Kxo0bKS4uxul00rNnT04++WQmTJhAZmZmW70MkVale2vjdG+tW1PvlXXdkw3DICEhgSOPPJJzzz2Xiy++GIdDPx7KwUH338bp/ltTtO+jV155JatWrYr4+eeffz633nprq+zlYKbvktJk9f0f8eijj27jnex/7rrrLq6//nrS0tKivZU2dfLJJ3PyyScDsHv3bpYtW8Ybb7zBf//7X9555x169uwZfu7mzZu55ZZb+Omnn+jUqRODBw+mW7du+Hw+fvzxR9566y1ee+01/vnPf3LmmWdG6yWJtDjdW5vvYLy37su9svo92e/3k5+fz+eff85f/vIXvvrqKx5//PFovCSRqNH9t/kOxvsvRO8+ev7554fXDfnss8/Izs7mzDPPrPU1e/TRR5OWlsZHH31EUlJSq+zpYKQgijTZbbfdFu0t7LdSU1NJTU2N9jba3Mknn1zj68bn83H99dfzxRdf8Oyzz/LXv/4VgJ07d3LVVVeRn5/Pb3/7W+666y5iY2NrXGvXrl1Mnz6d0tLSNn0NIq1N99bmO9jurft6r9z7ngywfft2xowZw5w5c7jzzjvp3r17q74GkfZE99/mO9juvyHRuo/WlRm1bds2srOz+dWvflVv5tThhx/e4ns5mKknirQKr9fLjBkzOPfcczn++OM58cQTueyyy/joo49qPXflypX06dOHf/zjH3Veq65a7Op1nitWrODKK6/khBNO4MQTT+SGG27gp59+qvNaW7Zs4fbbb2fgwIH079+fSy65hIULF9b7OlasWMEDDzzA6NGjOfHEEznuuOMYO3Ys06dPx+Px1NpnKL3vN7/5DX369An/G9JQ7eFHH33E5ZdfzoABAzjuuOM499xzef755/F6vfW+JxUVFTzyyCMMHz6cY489lpEjRzJjxgxM06z3NbUHTqeTiy66CIB169aFjz/11FPk5+czduxY7rvvvlq/FAB07tyZBx98kDFjxtQ4XlhYyEMPPcSIESM49thjGTRoELfeeivffvttrWs09+unsrKSGTNmMH78eE444QROOOEEzjnnHKZMmcLOnTv35S0RiYjurbq3wr7dK+uTkZHBYYcdBkBRUVFE5zTl6zFk3bp13HHHHZx++ukce+yxDBkyhGuuuabBc0KCwSBTpkyhT58+3HrrrVRVVUW0T5GWoPuv7r+Naeg+Gnp95eXl/PWvf2XEiBEcc8wx9X6NhIQCM8ceeyyzZ89u1r7UZ6rlKRNFWpzX6+Xaa69l1apV9O7dm8suu4yqqirmzZvHnXfeSXZ2NnfddVeLrLVw4ULmz5/P6aefziWXXMJPP/3EokWLWL9+PXPnziUlJSX83JycHC6++GKKi4sZOnQoRx99NFu2bOGWW27h9NNPr/P6//d//8fmzZs54YQTGDZsGF6vl6+++op//OMfrFy5kldeeQW73Q5Y31zmz5/PqlWrOP/88znkkEMifh1PPPEEzz//PJ06dWLs2LHEx8ezZMkSnnjiCZYuXcqLL76Iy+WqcY7P5+Paa6+lsLCQoUOHYrfb+eyzz3j88cfxer37Tf2jYRgAVFVV8cEHHwBwyy23NHpe9fcjNzeXyy67jMLCQgYNGsSYMWPIy8vj448/ZuHChfzjH//gjDPOqHWNpnz9lJSU8Jvf/Ibs7GwOO+wwJkyYgNPpJDc3l5kzZzJy5Ei6dOmyr2+HSL10b9W9FfbtXtmQvLw8Nm/eTEJCAr179270+c35enznnXeYPHkyNpuNESNGcOihh7Jr1y6+/fZb3nzzTUaPHl3veh6Phz/84Q988sknXH755dx///3YbPq7QGkbuv/q/huJxu6jXq+X3/zmN5SUlDB48GASExMbzFbJzs7m+uuvx+12M2PGDE477bTW3L40gYIo0mR1RUwPOeSQcPrYyy+/zKpVqxg6dCjPPvtsuLHSrbfeyoUXXsjzzz/P8OHDOfHEE/d5L5999hkvvvgip556avjY448/zowZM5g5cybXX399+Phf/vIXiouLue+++/jtb39b4xr1/SA6efJkunfvHv5FP+Spp57i2WefZd68eeEf+q666irKysrC32gibb719ddf8/zzz9OtWzfeffddunbtCsDdd9/NrbfeyoIFC3jppZe48cYba5xXWFhIZmYmL7/8cvhvIW+99VZGjRrFK6+8wu9+9zucTmej669cubJJDapg39Ne/X4/b7/9NgDHHXccAN9++y1er5e0tLSIfoCvbvLkyRQWFnLHHXdw0003hY9fdtllXHHFFdx77718/vnnJCQk1DivqV8/2dnZXHLJJTz44IM1fnh3u90Eg8Em7Vlkb7q36t4ayb11X+6VIatWrQp/vfn9fgoLC/n8889xuVw8/PDDJCYmNnqNpn49/vjjjzz00EMkJiby73//myOPPLLG9fLz8+tdq7i4mJtuuomvv/6au+++mxtuuKFZr1ukPrr/6v7b1J9tm3Mf3bFjB0cccQSvv/468fHxDV5/+fLl3HbbbcTFxfHGG29ooEI7oyCKNNneHanBqgsMfaOZOXMmhmFw77331uhM3blzZ2666Sbuv/9+3n333Rb5RjN69Oga32QALrroImbMmMH69evDx/Lz81m2bBndu3fniiuuqPH8X/3qV5x88sl13mx79OhR57pXXXUVzz77LEuWLGnwb84iMXPmTABuuumm8DcZAIfDwR//+EcWLVrEu+++W+sbDcD9999fI427c+fOnHnmmcyePZvNmzdz1FFHNbr+qlWr6vwzbci+fKMpLi5m6dKl5OTk0KlTp3DQo7CwEKDOaT0Nyc/PZ+nSpWRkZHDdddfVeOzEE09kzJgxfPjhh3z66aeMGzeuxuORfv3s2rWLjz76iK5du/LHP/6x1t9+7h2cEWkO3Vt1b43k3trce2V1q1atqvXn4nA4uOCCC8KB7cY09evxzTffxO/3c/PNN9cKoDT0erZt28Z1111Hbm4uWVlZnHfeeZG+TJGI6f6r+29zfrZtzn303nvvbTSA8sEHHzBp0iR69uzJCy+8QEZGRpP2Jq1PQRRpsu+++67ex8rLy9myZQtpaWl1NjAaNGgQAP/73/9aZC/HHntsrWPdunUDrPKLkI0bNwIwYMCAcIpidfV9o6moqOBf//oXn376KTk5Objd7ho1maEfZvdFaG+h96a6ww47jPT0dLZu3UpZWVmNrtpJSUn06tWr1jmhH0Qjbbx62223tXpDterfaJxOJ926deOSSy7hxhtvDP95NVf1P9u6/nZi0KBBfPjhh2zcuLFWECXSr5/169cTDAYZOHBgo9/4RJpL91bdW9vKrbfeGt5bMBhkx44dfPbZZ/ztb39j/vz5vPvuuw3em5vz9bh27VqAeksM6rJ582YuvvhiKisr+b//+79av1iKtBTdf3X/barm3EdjYmIaHav9r3/9i/n
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1440x360 with 3 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plot = sns.lmplot(\n",
|
|||
|
" x=\"Gr Liv Area\", y=\"SalePrice\", col=\"Foundation\", hue=\"Foundation\",\n",
|
|||
|
" col_order=[\"PConc\", \"CBlock\", \"BrkTil\"],\n",
|
|||
|
" data=df, robust=True, col_wrap=4, ci=None, truncate=True, scatter_kws={\"s\": 15},\n",
|
|||
|
")\n",
|
|||
|
"# Adjust font sizes.\n",
|
|||
|
"for ax in plot.axes:\n",
|
|||
|
" ax.set_title(ax.get_title(), fontsize=20)\n",
|
|||
|
" ax.set_xlabel(ax.get_xlabel(), fontsize=16)\n",
|
|||
|
" ax.set_ylabel(ax.get_ylabel(), fontsize=16)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 52,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"foundation = pd.get_dummies(df[\"Foundation\"], prefix=\"found\")\n",
|
|||
|
"# Only keep the top 3 realizations.\n",
|
|||
|
"del foundation[\"found_Slab\"]\n",
|
|||
|
"del foundation[\"found_Stone\"]\n",
|
|||
|
"del foundation[\"found_Wood\"]\n",
|
|||
|
"df = pd.concat([df, foundation], axis=1)\n",
|
|||
|
"del df[\"Foundation\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 53,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.extend([\"found_BrkTil\", \"found_CBlock\", \"found_PConc\"])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 54,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>found_BrkTil</th>\n",
|
|||
|
" <th>found_CBlock</th>\n",
|
|||
|
" <th>found_PConc</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" found_BrkTil found_CBlock found_PConc\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 1 0\n",
|
|||
|
"2 526350040 0 1 0\n",
|
|||
|
"3 526351010 0 1 0\n",
|
|||
|
"4 526353030 0 1 0\n",
|
|||
|
"5 527105010 0 0 1"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 54,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[foundation.columns].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Garage Type\n",
|
|||
|
"\n",
|
|||
|
"As can be expected, the *Garage Type* looks very similar to the above *has Garage* variable. Therefore, it is dropped."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 55,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACpXklEQVR4nOyddXhU19aH3zMSd1cSElyDEwhQgpYAQYu0tKVChZZC3ZC6t7SXtrf96kaRAkFKkeDuxYKFhBCbuGf8fH/sZIITIIFLe97nmYeZPefsvedMOGv2Xmv9liTLsoyCgoKCgkIdorrVE1BQUFBQ+OehGBcFBQUFhTpHMS4KCgoKCnWOYlwU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mdTsfy5ctZtmwZI0aMqLP5X416XblUVFSwbds2Xn/9dVvbpEmTmDp1KgsXLiQoKIjZs2cD0KtXLzZu3Ei/fv1wdHTk7bffBsDDw4PHH3/cpko6efJkm1z1zJkzeemll9Dr9fTs2ZOePXtecQwFBQWF2vDBquNUms4Xpaw0Wfhg1fEbXr2AkICZMmUKL7/8Mi4uF8v+d+7cmddee42CggJWrVrFgAEDbGrH3bp1w9PTE4B+/fqxd+9eNBoNhw8ftt0n9Xo93t7e9O7dm7Nnz/LGG2/Qq1cvYmJibnjutaVejYuTkxM7d+48r83T05Mff/zxomMlSbIt4y5k1KhRtot2Lq1bt2b58uUXtV9uDAUFBYXakFlUeU3t14LJZGLKlCkMGTKE/v37X/a46jotK1as4J133rG1X+hDrpbSHz58+CV92wk
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Garage Type\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 56,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Garage Type\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Heating\n",
|
|||
|
"\n",
|
|||
|
"Most of the houses have gas. The variable is not helpful."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 57,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFW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a+G5cuXc8cdd7BixYoaXqmgjItCobg6iovAYKjrVdz8RM+Hz9rCDBf5b/T86zrcjh07sLS05N577y3b5uPjw4MPPkhcXBz33XcfI0eOZOTIkezbtw+ApKQk7r//fkaMGMGwYcPYs2cPIIZq9erVfPDBB2zdupWCgoLrWltlqCZKhUJRfU6Ew6pXwNkXBs4CffU71v9VRM+HvydDUalQZUasvAZof/c1HfL48eO0adOm0vfc3d358ccfsba2JiYmhhdeeIHFixezfPlyevbsyVNPPUVJSQl5ebKeffv20aBBAxo2bEjXrl3ZuHEjAwcOvKZ1VYUyLgqFonoUF4lhSTkuj0NLlHGpivB3TIbFSFGebL9G43Ixb7/9Nnv37sXS0pKffvqJd955hyNHjmBmZkZMTAwgyvGvv/46xcXF9O/fv0y6pfycrSFDhrBs2TJlXBSKOiEzHlJOgmtTcGlQ16upG8zMxWNJOS6vbZzrdj03MxlxV7e9Gvj5+REWFlb2evr06aSmpjJmzBh++ukn6tWrx7JlyzAYDLRv3x6Azp078+uvv7Jp0yZeffVVJkyYwPDhwwkLCyM8PJxvvvkGTdPK5rvUpFKyyrkoFOVJPAgHl4ghMZIZD388AD8Ph9/GQNqZKx/HYICimo9j1ylmZhIK6/0yDJgF7e+p6xXdvDhX8QOkqu3VoFu3bhQUFPD777+XbcvPzwcgKys
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Heating\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 58,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Heating\"]\n",
|
|||
|
"# Also discard the associated ordinal variable.\n",
|
|||
|
"del df[\"Heating QC\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### House Style\n",
|
|||
|
"\n",
|
|||
|
"In summary, this variable is very similar to the above derived variable *has 2nd Flr*. Therefore, it is dropped."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 59,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACyaklEQVR4nOydd3hU1daH3+k1yUzapJJCqKGEDobeixCqYkHBgiKKihc7ioLlU+xcvXJFFL2KgnRQSuiCoRN6D6T3zKRMn/n+mDCAJBhIApbzPo+PmX322XvnZJg1e6+1fkvkdrvdCAgICAgI1CHiW70AAQEBAYG/H4JxERAQEBCocwTjIiAgICBQ5wjGRUBAQECgzhGMi4CAgIBAnSO91Qv4s9CpUyfCw8Nv9TIEBAQE/lJkZmaSkpJyVbtgXCoJDw9nyZIlt3oZAgICAn8pRo4cWWW7cCwmICAgIFDnCMZFQEBAQKDOEYyLgICAgECdI/hcBAQEBH6H3W4nIyMDi8Vyq5fyp0GpVBIREYFMJqtRf8G4CAgICPyOjIwMfHx8iI6ORiQS3erl3HLcbjeFhYVkZGQQExNTo3uEYzEBAQGB32GxWAgICBAMSyUikYiAgIDr2skJOxcBAYG/BW63m7ItW7GdO4u6fQdULVvUajzBsFzJ9T4PwbgICAj8LahISSFj0iRwu5EEBxP9w0LkoaG3eln/WIRjMQEBgb8F9rx8qCxP5czLw2U0Vtv3RstYtWnT5orXS5Ys4fXXX7+hsWrDgQMHGDNmDElJSQw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
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"House Style\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 60,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"House Style\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Land Contour\n",
|
|||
|
"\n",
|
|||
|
"This variable is assumed to contain the same information as the ordinal variable *Land Slope* and is dropped."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 61,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACnZUlEQVR4nOzdd3hUVfrA8e/UzGQymUmbSe8JgRRC78VAQCmCgL1ib6ti77rW/alrWdl1ZXUtu64KSBFBQTpIryEhlJCE9Emdlkyf+f0xMIAUQRMRvZ/n8TG5c+89h5R5c+45531FPp/Ph0AgEAgEnUh8vjsgEAgEgt8fIbgIBAKBoNMJwUUgEAgEnU4ILgKBQCDodEJwEQgEAkGnk57vDvxWDBgwgLi4uPPdDYFAILig1NbWsnnz5pOOC8HliLi4OObNm3e+uyEQCAQXlClTppzyuPBYTCAQCASdTgguAoFAIOh0QnARCAQCQacT5l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oaCsDmzZu5/vrrue+++7j44ot56KGH8PlO/P7Y7XZuvfVWZs/u3H6ciTByEQgEZ23tgSb+vKiEWK2SZyb0IFOvPt9d+u0pmg2L7gPXkUSVpmr/5wB5V/zs29rtdiZNmoTD4aCpqemE5Lx79+5l8eLF6HQ6rr76arZv307fvn0Bf3b6Bx98kMmTJwfKv/8ahJGLQCA4Ky63lz8vKuFQUzvrDjazuKj+fHfpt2nFC8cCy1Eum//4L3D0sdh3333HBx98wGOPPRYYoeTl5REdHY1YLCYrK4va2mO
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Land Contour\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 62,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Land Contour\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Lot Configuration\n",
|
|||
|
"\n",
|
|||
|
"This variable shows no good pattern and is dropped."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 63,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACq0ElEQVR4nOzdd3yT1f7A8U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FXEXIWlpa2rS/AoHgr0HILdZKZgxvx7PLj553aUwpkzBjeLs2bddgMPDggw9iNpsBeOaZZy54zGuvvcbMmTMRiUTnTehPmTKF8vJybrjhBpxOJ35+frz77rtt2l+BQPDXIKTcP601Uu635Wqx64mQcl8g+OsQUu7/ASZ0Dv9LBhOBQCD4OWHORSAQCAStTgguAoFAIGh1QnARCAQCQasTgotAIBAIWp0QXAQCgUDQ6oTVYte4mpoaXn31VY4ePYpKpSIgIICZM2cSGxt7tbsmEAgElyQEl2uY0+nk4YcfZsKECcyfPx+A48ePU1dX94vBxWazIZX+vre3Nc4hEAj+moRPjtaU9TVsfAmaysA3AobMgo43/ubT7d69G6lUel5tluTkZJxOJ6+//jrbtm1DJBLxwAMPMGrUKPbs2cObb76JSqWisLCQl1566ZJp+rOzs/m///s/Wlpa8PPz47XXXiM4OJjbb7+d5ORkDhw4wJgxY7j77rtb45UR/IlY7VYkYglikXBVXXBpQnBpLVlfw5pHwHo6UWVTqes2/OYAc+rUKVJTUy84vmHDBo4fP86
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Lot Config\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 64,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Lot Config\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### MS SubClass\n",
|
|||
|
"\n",
|
|||
|
"By looking at this variable's realizations, one can see that several distinct features are lumped together in one. In particular, the above variables *has 2nd Flr* and *build_type_\\** and the future age related features at the bottom of this notebook together should comprise the same patterns in a more advantagous way. Thus, the column is dropped."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 65,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"['1-STORY 1946 & NEWER ALL STYLES',\n",
|
|||
|
" '1-STORY 1945 & OLDER',\n",
|
|||
|
" '1-STORY W/FINISHED ATTIC ALL AGES',\n",
|
|||
|
" '1-1/2 STORY - UNFINISHED ALL AGES',\n",
|
|||
|
" '1-1/2 STORY FINISHED ALL AGES',\n",
|
|||
|
" '2-STORY 1946 & NEWER',\n",
|
|||
|
" '2-STORY 1945 & OLDER',\n",
|
|||
|
" '2-1/2 STORY ALL AGES',\n",
|
|||
|
" 'SPLIT OR MULTI-LEVEL',\n",
|
|||
|
" 'SPLIT FOYER',\n",
|
|||
|
" 'DUPLEX - ALL STYLES AND AGES',\n",
|
|||
|
" '1-STORY PUD (Planned Unit Development) - 1946 & NEWER',\n",
|
|||
|
" '1-1/2 STORY PUD - ALL AGES',\n",
|
|||
|
" '2-STORY PUD - 1946 & NEWER',\n",
|
|||
|
" 'PUD - MULTILEVEL - INCL SPLIT LEV/FOYER',\n",
|
|||
|
" '2 FAMILY CONVERSION - ALL STYLES AND AGES']"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 65,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"list(ALL_COLUMNS[\"MS SubClass\"][\"lookups\"].values())"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 66,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"MS SubClass\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### MS Zoning\n",
|
|||
|
"\n",
|
|||
|
"This variable is dropped as most houses are located in a \"residential\" zone."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 67,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"RL 2252\n",
|
|||
|
"RM 459\n",
|
|||
|
"FV 131\n",
|
|||
|
"RH 27\n",
|
|||
|
"C 25\n",
|
|||
|
"A 2\n",
|
|||
|
"I 2\n",
|
|||
|
"RP 0\n",
|
|||
|
"Name: MS Zoning, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 67,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[\"MS Zoning\"].value_counts()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 68,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACpKklEQVR4nOzdd3hUVfrA8e+UTDLpfSa990ICgSQEEggGkBApoq4orth21f2566q7a3dtu+vqqrtusfddC1KkSAs1dAIhnfSeTHqfSab9/pgwEAkIkoDo/TyPj8mdO+ecTIa8c+85531FRqPRiEAgEAgE40h8pQcgEAgEgh8fIbgIBAKBYNwJwUUgEAgE404ILgKBQCAYd0JwEQgEAsG4k17pAfxQJCYm4uXldaWHIRAIBFeVxsZGDh06dNZxIbiM8PLyYvXq1Vd6GAKBQHB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P6eqU/wWsfwC0atP3PfWm7+GSAkx5eTlRUVHjMMBLJ3z0EAgEF0Sv07Ljg7foamqgNv84Jw/kXOkhXb2ynz0dWE7Rqk3HfySE4CIQXIC+jnbqCk/Q2952pYdyxYjFEuxd3czfW9nYXMHRXOV6Gi7u+AUKCQmhqKjoktoYL0JwEQjO0FZXw8kDOXQ1N5mP9XW0s+7lF/jyucdZ/een6WltOU8LJkaDAZ1WO5FDvexEYjGzbruLpKU/I+22u4icmX6lh3T1cvC+uOMXKCkpieHhYT7//HPzsdLS0iuScl+YcxEIRrTX1/LlHx9D3d+Lk4cXy554HntXNzqbGlBVlQPQUV9HR0M9Du7Kc7bTrWpm98f
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"MS Zoning\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 69,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"MS Zoning\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Masonry Veneer Type\n",
|
|||
|
"\n",
|
|||
|
"None of the groups have a slope differing from the overall one."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 70,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR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YQFlZGWVlZWzYsIGePXsSHByMt7c3e/bsQRTFC7b12z5kZGRkrpaFu7N4dv5+skqrEYGs0mqenb+fhbuzLnvtpbBarYwaNYohQ4bwwgsv8MADD3jOHTx4kOeff75O3MrJkyf5+9//zr///W9at27NsWPHSEpKumj7Z86cYfbs2XzwwQc89dRTdOnShcWLF6PT6Vi7dq2nnp+fHwsWLGDixIl8+umn1/SeoJFnLmcT4bz88suesilTpvDoo48yb948wsLCmDVrFiAl5lm7di0DBw5Er9czY8YMAEwmEw888ADjxo0D4MEHH8RkMgEwdepUnn32WaxWK71796Z3796X7ENGRkbmavm/pUeodrjqlFU7XPzf0iPXNHs5d1ls9+7dPP300559lVatWhEZGempW1xczAMPPMB7771HXFxcvdrv3bs3arWahIQEXC6X53syISGBzMxMT71BgwYB0LJlS5YvX37V7+csjWpcDAYDW7durVPm5+fH7Nmzz6srCAJTp069YDvjxo3zGJdzadWq1QU3ty7Wh4yMjMzVkl1afUXlV0O7du0oKSmhuLgYkL5Dz8VoNBIWFsbOnTs9xiUuLo60tDQGDBhwwTbPyvgrFArUarVnD1qhUOBy1RpLtVp9wfKrRY7Ql5GRkakHYaYLb45
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Mas Vnr Type\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 71,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Mas Vnr Type\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Miscellaneous Features\n",
|
|||
|
"\n",
|
|||
|
"This variable is basically a \"other\" field with no pattern."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 72,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACtHElEQVR4nOzdZ2BUVdrA8f+UTHovk957DxCSEEggVEGkiw0Vdd21rGtZfXV3Rde+rgXbWtZeVlGkSJMSSuglkIT03pNJz6RMkmnvhwkDkWKARETv7wvJnTv3nEzCPHNPeR6RXq/XIxAIBALBCBJf6Q4IBAKB4LdHCC4CgUAgGHFCcBEIBALBiBOCi0AgEAhGnBBcBAKBQDDipFe6A78WCQkJeHh4XOluCAQCwVWlrq6Ow4cPn3VcCC6DPDw8WLNmzZXuhkAgEFxVFi5ceM7jwrCYQCAQCEacEFwEAoFAMOKE4CIQCASCESfMuQgEAsEZ1Go1tbW19PX1Xemu/KqYmZnh6emJiYnJsM4XgotAIBCcoba2Fmtra3x9fRGJRFe6O78Ker2e1tZWamtr8fPzG9ZzhGExgUAgOENfXx+Ojo5CYDmDSCTC0dHxou7mhDsXgUDwm6DX66k4cYy2uho8w6NwDQi65GsJgeVsF/uaCMFFIBD8JtTknWTty8+AXo+lvQM3Pf8aNo5OV7pbv1vCsJhAIPhN6GlvhcHyVD3tbfR1dZ333IspYxUSEsJf//pX4/cajYbExET++Mc/ApCens4HH3xwib02ePzxx0lLS2PevHnMmzePzz///KKvUVtby4YNGy6rHyNJuHMRCAS/CZ7hUfjFjaMq5wTj5y3BwcPzrHO0Gg3Z2zaTs+NHQiZMZOzchchMzS54XQsLC0pKSujr68PMzIz9+/cjl8uNj0+d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2cn+/btY+LEibi4uGBlZUVWVhZ6vf6c1/ppGwKBQDDa1p2o44k1J6nrUKEH6jpUPLHm5GUFmL6+viGrbzdv3jzk8ba2Nt59911jKv7IyEg++eQTJkyYQE5ODr29vQBs3ryZ2bNnX86PN2yjOizW29vLgQMHeOaZZ4zH7r77bh588EFWr16Nu7s7K1euBAzFePbs2cP06dMxNzfnhRdeAAzpqe+9915jOuj77rvPmLL6qaee4oknnqCvr4+UlBRSUlIu2IZAIBCMtn9vLUKl1g45plJr+ffWIubHXVq+rp8bFsvOzqa0tJQbb7wRALVaTWxsLFKplEmTJrFr1y5mzpzJnj17ePTRRy+pDxdrVIOLhYUFhw8fHnLM3t6ezz777KxzRSIRTz311Dmvs3jxYmNwOVNUVBQbN2486/j52hAIBILRVt+huqjjI0Gv15OcnMxrr7121mOzZ8/mq6++wtbWlsjISKysrEatH2cSdugLBALBCHK3M7+o4yMhNjaW48ePU1VVBRhGjSoqKgAYP348+fn5fPvtt7/YkBgIwUUgEAhG1KMzQzA3GVpm2dxEwqMzz18H5uf8dM7llVdeGfK4g4MDL774Ig8//DBz585l6dKllJeXA4aiYZMnT2bv3r1MmTLlkvtwsYSU+4OElPsCgQBGJuX+uhN1/HtrEfUdKtztzHl0Zsglz7f8mlxMyn2hWJhAIBCMsPlxHr+JYHI5hGExgUAgEIw4IbgIBAKBYMQJwUUgEAgEI04ILgKBQCAYcUJwEQgEAsGIE1aLCQQCwVWgpaWFF198kaysLGxtbTExMeGuu+5i+vTpw3p+Q0MDjz32GK2trYhEIq6//npuu+22UeuvEFwEAoHgV06v13Pfffcxf/58Xn31VQDq6urYuXPnsJ6v0WiQSCQ8/vjjRERE0N3dzaJFi0hOTiYwMHBU+iwEF4F
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Misc Feature\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 73,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Misc Feature\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Roof\n",
|
|||
|
"\n",
|
|||
|
"Roofs in Ames, IA, are not special enough to make a difference in the price. Even \"hip\" roofs seem already priced in bigger houses."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 74,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACXtklEQVR4nOydd1gUZ9eH7116b1IUUcQuFjR2rBiwILHH9GiKiZqYnphiiSYmb5opfkk0xfSmUYjdiL13sXcUkKL03na+Pw7LgoKigi3PfV17ZXd2dp6ZjczZ035Hp2mahkKhUCgU1Yj+Zp+AQqFQKO48lHFRKBQKRbWjjItCoVAoqh1lXBQKhUJR7SjjolAoFIpqx/xmn8CtQqdOnfD29r7Zp6FQKBS3FXFxcWzbtu2S7cq4lODt7c2CBQtu9mkoFArFbcXQoUMr3K7CYgqFQqGodpRxUSgUCkW1o4yLQqFQKKodlXNRKBR3LIWFhcTGxpKXl3ezT+W2x9ramrp162JhYVGl/ZVxUSgUdyyxsbE4ODjg6+uLTqe72adz26JpGsnJycTGxtKgQYMqfUaFxRQKxR1LXl4ebm5uyrBc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NOGnn34iPz+f//u//6NevXpMnDgRS0tLDhw4QHZ2NhMnTqR3796cP3+eOnXqlK7l5+dX+ry4uJi33nqLPXv24OnpyZdffom1tTVRUVG8+eab6PV6unbtyoYNG6rFw7kD/3UoFIoa40QkfNUFfhkGiYevvP/tRNRfsGgCpMcAmvx30QTZfo1UJrm/cuVKjhw5QkR
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Roof Matl\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 75,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACh+ElEQVR4nOydd3hURffHP3dbdrPpvQcSei9SQigChg6h2lFRbKAIVhQBFcv72kBfG/zEjgUQiBQFpXep0iGUkN572X5/f0zYECEYIAHR+3mePGxm587M7oZ7duac8z2SLMsyCgoKCgoKdYjqei9AQUFBQeGfh2JcFBQUFBTqHMW4KCgoKCjUOYpxUVBQUFCocxTjoqCgoKBQ52iu9wL+LnTp0oXQ0NDrvQwFBQWFG4q0tDR27tx5QbtiXCoJDQ1lyZIl13sZCgoKCjcUI0eOvGi7ciymoKCgoFDnKMZFQUFBQaHOUYyLgoKCgkKdo/hcFBQU/lVYrVZSU1MxmUzXeyk3FHq9nrCwMLRaba36K8ZFQUHhX0Vqairu7u40aNAASZKu93JuC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PTo0cTHxzNjxgzsdvsFfa4VinFRUFCoNaVbtnJ6WDzJDz6EKTHxei+n/jmwEJZPgqIUQBb/Lp90VQYmMTGRFi1aXPQ5X19fPv/8c5YuXcrs2bN59dVXq5Zy4ADTp09n1apVpKSksGbNmmrXnjp1ip9//pnvvvuOhIQEVCoVy5cvv+J1Xi3KsZiCgkK
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Roof Style\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 76,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Roof Matl\"]\n",
|
|||
|
"del df[\"Roof Style\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Sale Info\n",
|
|||
|
"\n",
|
|||
|
"Partial and abnormal (= foreclosure) sales seem to make a change with higher and lower prices respectively. These two types will be encoded in factor variables *partial_sale* and *abnormal_sale*. The impact seems to be not big though."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 77,
|
|||
|
"metadata": {
|
|||
|
"scrolled": true
|
|||
|
},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Normal 2396\n",
|
|||
|
"Partial 233\n",
|
|||
|
"Abnorml 189\n",
|
|||
|
"Family 46\n",
|
|||
|
"Alloca 22\n",
|
|||
|
"AdjLand 12\n",
|
|||
|
"Name: Sale Condition, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 77,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[\"Sale Condition\"].value_counts()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 78,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACvtElEQVR4nOydd3iUVfbHP1OSmdSZ1EnvlUAINYQqoTfp9gKrYv2p2FZ0UVax7NoVdcXurmsBKVIUpEgn9BIIEFJIn0mdkkyf+f0xMIAEDJCArO/neXiYue99772ZTObMveec7xE5nU4nAgICAgIC7Yj4ai9AQEBAQOB/D8G4CAgICAi0O4JxERAQEBBodwTjIiAgICDQ7gjGRUBAQECg3ZFe7QX8UcjOziYyMvJqL0NAQEDgmqKyspK8vLxz2gXjcpLIyEgWLVp0tZchICAgcE0xadKkVtuFYzEBAQEBgXZHMC4CAgICAu2OYFwEBAQEBNodweciICDwp8FqtVJRUYHJZLraS7nmkMvlREVF4eHh0ab+gnEREBD401BRUYGfnx9xcXGIRKKrvZxrBqfTSX19PRUVFcTHx7fpHuFYTEBA4E+DyWQiKChIMCwXiUgkIigo6KJ2fMLORUBA4H8Cp9PJ+qMajmsM9IkPIjNa2Wo/wbBcGhf7ugnGRUBA4H+CbcX13PXlLpxOCPWTsfTBfoQrva72sv60CMdiAgIC/xNodCZOVafS6M00tVjP3/mMMlYffvghY8aMYdy4cYwfP579+/dfcJ6nn36an3/++aLWtmTJEsaOHcu4ceOYMGECn3766UXdfz5uv/12Dh48CMA999yDTqdDp9Px9ddfu/uo1Woefvjhd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jIIDg4GICgoCA0Gg2hoaFoNBq3xLVKpaKmpsZ9X01NDSqVCpVKdZZSqVqtpnfv3uftf6E5BAQEBC6WJXsreW3VUaqajEQovXhyRCoTukVe1phSqZQbb7yRL7/8kpkzZ551raKigmeeeYbGxkYCAwN55ZVXiIiI4Omnn8bT05OCggK6d++OVqtFJpNRUFBAfX09L7/8MkuWLGHfvn107drVvTN6/vnnOXjwIGazmREjRlyxwmEdvnNZsWIFY8aMcT/Pzc11F8pZsmQJQ4YMOavd6XSyb98+/Pz8CA0NpX///mzevBmtVotWq2Xz5s3079+f0NBQfH192bdvH06ns9WxfjuHgICAwMWwZG8lsxYdpLLJiBOobDIya9FBluytvOyxb731VpYtW4Zerz+rfe7cuUycOJFly5Yxbtw45s6d676mVqv59ttvmTVrFgA6nY7vvvuOWbNmcf/99zNt2jRWrFjBsWPHKCgoAGDmzJksWrSIH3/8kZ07d3LkyJHLXntb6FDj0tLSwtatWxk+fLi7bcaMGWzZsoXhw4ezdetWZsyYAbj0d6Kjoxk2bBizZ8/m+eefB0CpVPLAAw8wZcoUpkyZwoMPPohSqQRcFvlvf/sbw4YNIyYmhoEDB15wDgEBAYGL4bVVRzFaz1YHNlrtvLbqXMHIi8XX15fx48fz1VdfndW+d+9et496/Pjx7N69231t5MiRSCQS9/PBgwcjEolITU0lODiY1NRUxGIxSUlJbpn+n376iYkTJzJhwgQKCwspKiq67LW3hQ49FvP29iYvL++stoCAAL788stz+opEIrdB+S2nDMtv6dKli1shtC1zCAgICFwMVU3Gi2q/WO68804mTZrEpEmT2tTfy8vrrOenRCdFItFZApRisRibzUZ5eTmfffYZCxcuRKFQnFUcrKMRMvQFBAQEzkOE0uui2i8WpVLJyJEjWbhwobutW7durFixAnBVjOzZs+clj9/c3IyXlxd+fn7U1dW
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Sale Condition\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 79,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABasAAALiCAYAAADXd4rWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOzdd3hUddrG8e+ZmUwKaQTSBERAAgSRLqCIiiIWVFCx4yKo61pQRF11l3VX1HVX7O5awK6ri1L0pYiCBRBFRRHYgEgVMCQIpGfqOe8fQyYJ6ZBkQnJ/rssr5szMOc9Mwi9w55nnZ1iWZSEiIiIiIiIiIiIiEkK2UBcgIiIiIiIiIiIiIqKwWkRERERERERERERCTmG1iIiIiIiIiIiIiIScwmoRERERERERERERCTmF1SIiIiIiIiIiIiIScgqrRURERERERERERCTkFFbLYenWrRvjxo0LdRlNzrPPPku3bt1YtWpVueOH83rde++9dOvWjV27dtVniXIUmDNnDt26dWPOnDmhLkUagdbTymk9bXz6XtT3SnOn7/HKab1tOnbt2kW3bt249957yx1vDq9rc3gOUr+0JldOa3Ljq+y1rerrII3DEeoCpP75/X5mz57Nhx9+yKZNmygsLCQ2Npa2bdty4oknMnz4cM4888xQl1krRUVFzJo1i08//ZSff/6Z/Px8IiIiOO644zjllFO49NJL6dChQ6jLPCzPPvsszz33HG+88QaDBg0KdTkhV/J6APzlL3/h6quvrnCfOXPmcN9993HTTTcxefLkxi5RWiCtp0cHradVKy4u5tRTTyU/P59Ro0bx+OOPh7okkUppvT06aL2tWijW227dugHw008/Nfi1pGXRmnx00JpcNf0d+OimsLqZ8fv9/P73v2f58uXExsZy2mmnkZKSgtfrZfPmzcyfP5+tW7ceFT9Y1qxZw6RJk8jKyiIlJYXTTjuNpKQkioqK2LBhAzNmzODll1/mv//9Lz179gx1udVauHAhkZGRdXrMnXfeyQ033EBycnIDVdV0/etf/+Kiiy4iOjo61KVIC6b1tGnSelo3CxcuJD8/H8Mw+Pjjjzlw4ACtW7cOdVki5Wi9bZq03tZNQ663Lfl1lcanNblp0ppcN/o78NFNYXUzM3/+fJYvX0737t156623iImJKXd7cXExP/74Y4iqq70tW7YwceJEioqKmDJlChMmTMDhKP/tunPnTqZPn05BQUGIqqy9Ll261PkxSUlJJCUlNUA1TVvHjh3ZsWMHM2bMUPe0hJTW06ZJ62ndzJo1C5vNxoQJE5g5cybz5s3juuuuC3VZIuVovW2atN7WTUOuty35dZXGpzW5adKaXDf6O/DRTTOrm5kffvgBgDFjxlT4oQIQGRnJ4MGDyx3Lz89n5syZXHvttQwbNowTTjiBwYMHc9NNNwXPV1s+n4+3336byy67jH79+tG7d29Gjx7NW2+9hWmatT7PQw89REFBATfccAM33nhjhR8qAB06dODpp5+mb9++5Y5v376de+65h1NPPZUTTjiBoUOHcs8997B9+/YK5yg7h+ijjz7i0ksvpXfv3px00klMnjyZrKysSutbv349EydOpG/fvvTr14/x48dX+1odOgNp+PDhwZEX1157Ld26dQv+V6K6+VILFy7k6quvpn///px44olccMEFvPjii3g8ngr3HT58OMOHD6eoqIh//OMfnH766ZxwwgmMGDGCl156Ccuyqqw7FK655hqSkpJ47bXX2LNnT60fl52dzd/+9jeGDx8e/B6+9dZbWb9+fYX7lp0JvWzZMsaNG0f//v2Dr3/Z27/88kuuuuoq+vbty+DBg7nvvvvIy8sDICMjg9///vcMHDiQvn37ctNNN1X69Vq/fj0PPfQQF154ISeddBK9evXi7LPP5tFHHyU3N/cwXylpaFpPtZ4e6mhbTzdt2sSaNWsYMmQIN9xwA2FhYbz33ns1Pi4rK4u7776bIUOGcOKJJ3LxxRfzf//3fxXut2rVKrp168azzz7Lhg0buPHGGxkwYAC9e/fmmmuu4fvvv6/0/Pn5+Tz++OOMHDmSXr16MXDgQCZOnMjKlSurvcbatWu58cYbOemkk4Jfz7K3r1u3jokTJ9K/f38GDhzIbbfdRmZmJhD4x+jkyZMZPHgwJ554IuPGjWPjxo11fEWloWi91Xp7qOa+3hYUFPD3v/+dYcOG0atXL8455xxeffXVKp9XfcydXbJkCXfddRcjR46kT58+9OnTh4svvpg33nij0u/zstd89913ueCCC+jVqxcnn3wyU6dOJT8/v9LrrFy5kquuuoo+ffpw0kkncfPNN7Nly5bDrlsan9ZkrcmHau5rcl199dVXTJw4kZNOOokTTjiBkSNHMn369CrXxZycHJ588klGjRpF79696d+/PxdeeCHTp0+nqKgoeD/lBqXUWd3MxMfHA1S6iFZly5YtPPXUUwwYMIDTTz+d2NhYMjMz+fTTT1m+fDnPP/88w4YNq/E8Xq+Xm266iRUrVtCpUydGjRpFeHg4q1atYtq0afz444889thjNZ5n586drFy5kvDwcK6//voa7+90OoP/v3btWq677joKCwsZPnw4xx9/PFu3buXDDz9k6dKlvPrqq5x44okVzvGf//yHTz/9lOHDhzNw4EDWrl3LwoUL2bhxIx988EG5a3z//fdcd911eL1eRowYQceOHdmwYQPjxo2r8EO7Ktdeey1Lly7lm2++YcyYMbRr165WjwN44oknePHFF2ndujWjRo0iKiqK5cuX88QTT7BixQpefvnlcvVC4GszceJEsrOzGTZsGHa7nSVLlvD444/j8Xi49dZba339hhYZGcntt9/On/70J5588kn+8Y9/1PiYnTt3ctVVV5Gdnc3gwYM5//zzyczM5KOPPuLzzz/n2Wef5YwzzqjwuMWLF7N8+XKGDRvGFVdcwa+//lru9k8//ZTPP/+c008/nSuuuIIffviBOXPmsGvXLqZMmcL48ePp378/l156KZs2beKzzz5j165dfPjhh9hspb8LnDVrFkuWLGHgwIGcfPLJmKbJ//73P1599VWWLVvGrFmzNPKkCdJ6qvX0aF9PZ82aBQT+sRkfH8/w4cNZvHgx3333HQMGDKj0Mbm5uVx55ZXExMRw8cUXk5+fz6JFi7jrrrvIysqq9Pto/fr1zJw5kz59+jB27Fh+/fVXPv74Y8aPH8+8efPo3Llz8L55eXlceeWVbN68mV69evG73/2OAwcOsGjRIiZMmMBf//pXrrjiigrXWLNmDS+++CL9+/fnkksu4cCBA4SFhQVvX7duHTNmzGDgwIFcdtllbNq0iY8//phNmzbx73//m6uuuorOnTszevToYH3XXXcdS5YsoVWrVkf6UssR0nqr9bYlrbcej4fx48ezbt06unfvzgUXXEB+fj7//ve/+eabbxqsxunTp2Oz2TjxxBNJTk4mPz+fr7/+mocffph169ZV+X3+2GOPsWLFCs444wxOOeUUVq1axaxZs9ixYwdvvPFGuft+9NFHTJ48mbCwMM477zwSExNZvXo1V1xxRbkATZo2rclak1vSmlxX7777Ln/961+JjIzknHPOoU2bNnzzzTfMmDGDzz77jHfeeYfY2Njg/Xfu3Mnvfvc7du/eTc+ePbnyyisxTZPt27fz2muvccUVVxAVFRWsW7nBQZY0K//73/+snj17Wt26dbPuuusua/HixdauXbuqfUxeXp61b9++CsczMzOtU045xTrnnHMq3JaWlmZdc8015Y4988wzVlpamvXggw9aPp8veNzn81n33XeflZaWZn3yySc1Poe5c+daaWlp1hVXXFHjfcsyTdM655xzrLS0NOuDDz4od9uCBQustLQ0a+TIkZbf769Qc9++fa2NGzeWe8ydd95ppaWlWQsWLCh3jZEjR1b6XF577TUrLS3NSktLs77++utyt1X3eh163xJ//OMfrbS0NGvnzp3BY99//72VlpZmnXbaaVZ2dnbwuNfrtX7/+99baWlp1vPPP1/uPGeccYaVlpZmXX/99VZxcXHw+G+//Wb179/
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 1440x720 with 6 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"plot = sns.lmplot(\n",
|
|||
|
" x=\"Gr Liv Area\", y=\"SalePrice\", col=\"Sale Condition\", hue=\"Sale Condition\",\n",
|
|||
|
" data=df, robust=True, col_wrap=4, ci=None, truncate=True, scatter_kws={\"s\": 15},\n",
|
|||
|
")\n",
|
|||
|
"# Adjust font sizes.\n",
|
|||
|
"for ax in plot.axes:\n",
|
|||
|
" ax.set_title(ax.get_title(), fontsize=20)\n",
|
|||
|
" ax.set_xlabel(ax.get_xlabel(), fontsize=16)\n",
|
|||
|
" ax.set_ylabel(ax.get_ylabel(), fontsize=16)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 80,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"partial_sale\"] = df[\"Sale Condition\"].apply(lambda x: 1 if x == \"Partial\" else 0)\n",
|
|||
|
"df[\"abnormal_sale\"] = df[\"Sale Condition\"].apply(lambda x: 1 if x == \"Abnorml\" else 0)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Homes that are sold for the first time cleare are priced higher. A factor variable *new_home* is introduced."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 81,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACx/0lEQVR4nOydd3iTVfvHPxlN0qZNd9NJ94JSShml7L0RBNTXLQ5UcCsOVERB9HW84FZ+LtwiMkRQKgXZm5YCbaGDQme605Wd/P4IBJCCBVpwPJ/r4iI5z/Occ5ImuZ9z7vv+3iKbzWZDQEBAQECgHRFf7QkICAgICPzzEIyLgICA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aAtJiAgIHCZzBoVyzPLD561NebsJGHWqNjL6jcmJoa6ujpHKseptubmZry8vGhpaeHEiRNMmjTJEYp86623/iVCkQXjIiAgIHCZnPKrvL7uCGX1OgI9nJk1Kvay/C1gr265f//+s9peffVVx+Pg4GCysrIua4yOQjAuAgICAu3ApO5Bl21M/kkIPhcBAQEBgXZHMC4CAgICAu2OYFwEBAQEBNodwbgICAgICLQ7gnEREBAQEGh3hGgxAQEBgb8oVVVVLFiwgIMHD6JSqfD29kYmk3HttdcyfPhwAEaNGsXEiROZMWMGAA8++CATJkzA3d2dGTNmEBISgk6nw8fHh7vvvpshQ4ZckbkLxkVAQEDgL4jNZuOBBx5g0qRJLFy4EIDc3FzS09PZv38/w4cPp66uDhcXF4d
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"Sale Type\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 82,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"new_home\"] = df[\"Sale Type\"].apply(lambda x: 1 if x == \"New\" else 0)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 83,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"new_variables.extend([\"partial_sale\", \"abnormal_sale\", \"new_home\"])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 84,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Sale Condition\"]\n",
|
|||
|
"del df[\"Sale Type\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Show summary of counts:"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 85,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"partial_sale 233\n",
|
|||
|
"abnormal_sale 189\n",
|
|||
|
"new_home 227\n",
|
|||
|
"dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 85,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"partial_sale\", \"abnormal_sale\", \"new_home\"]].sum()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 86,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>partial_sale</th>\n",
|
|||
|
" <th>abnormal_sale</th>\n",
|
|||
|
" <th>new_home</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" partial_sale abnormal_sale new_home\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0\n",
|
|||
|
"2 526350040 0 0 0\n",
|
|||
|
"3 526351010 0 0 0\n",
|
|||
|
"4 526353030 0 0 0\n",
|
|||
|
"5 527105010 0 0 0"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 86,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"partial_sale\", \"abnormal_sale\", \"new_home\"]].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Street Name\n",
|
|||
|
"\n",
|
|||
|
"Looking at the value counts this variable is pretty useless."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 87,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"Pave 2886\n",
|
|||
|
"Grvl 12\n",
|
|||
|
"Name: Street, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 87,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[\"Street\"].value_counts()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 88,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Street\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Age & Remodeling\n",
|
|||
|
"\n",
|
|||
|
"The dataset was put together over several years. Therefore, the variables with year numbers need to be aligned to indicate the right ages."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 89,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"# For one house the year of being remodeled is one year\n",
|
|||
|
"# before it was built. That input error is corrected.\n",
|
|||
|
"input_error = (df[\"Year Remod/Add\"] < df[\"Year Built\"])\n",
|
|||
|
"assert input_error.sum() == 1\n",
|
|||
|
"df.loc[input_error, \"Year Remod/Add\"] = df.loc[input_error, \"Year Built\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Introduce a factor variable *remodeled*. Almost half the houses were remodeled at some point in time."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 90,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"46"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 90,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"remodeled = (df[\"Year Remod/Add\"] > df[\"Year Built\"])\n",
|
|||
|
"df[\"remodeled\"] = 0\n",
|
|||
|
"df.loc[remodeled, \"remodeled\"] = 1\n",
|
|||
|
"round(100 * remodeled.sum() / df.shape[0])"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Create discrete variables *years_since_built* and *years_since_remodeled*."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 91,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"years_since_built\"] = df[\"Yr Sold\"] - df[\"Year Built\"]\n",
|
|||
|
"df[\"years_since_remodeled\"] = df[\"Yr Sold\"] - df[\"Year Remod/Add\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 92,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw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HT9+PG+99RZ5eXlcvHiR1NTUWz4O0yd3gJiYGL755huio6MdZWvXrqW8vJwJEyYwaNAg4uLi+N///V8AnnnmGU6ePMnAgQOZM2cOY8eObXD/ZWVlvPLKK4SGhjJ8+HAuXLhAfHx8g9scOHCAyMhIBgwYQFJSEhs2bMDb2/uWjqtHjx788Y9/ZNOmTfziF78gJiaGr776CoCEhATuu+8+pk+fzs9+9jNmzZrF//zP/zS6z3vuuQdfX19GjBjB4sWLWbVqFb179wbgqaee4q677mLo0KE8//zzREVFNSnO3r17ExkZycMPP8zAgQM1WqYeqqdNr6e1Pfnkk4SFhfHrX/+aAQMGMH369Dp/LTTFlClT+NWvfsUTTzzBmDFjsFqtrFixAoA+ffqwcuVKFi9ezIgRI/D19a3RTXMrcTT02U6fPp3hw4cTHR3NpEmTGv1s62IxDPMv1nH+/HnGjx/PRx99hI+PT1uHI1In1VNpTqZvuVdVVbFp0yYmTJigL4y4LNVTaW6mvqB65coVhg0bRo8ePRrtj2wJv/nNb/jss89uKp87dy5/93d/1+rxQPUNShs3bryp/Oc//3mbnCNRPa2L6untuyO6ZURE7jSm75YREbkTuUS3TGhoaI2bBmq7PnTLXSn+1nHu3LlbHoPdVhqr8zdyl/MPirUlNBRnQ3XeJZJ7z549HRMJ1SU7O5ugoKBWjKh5Kf7WceOdjq6usTp/I3c
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 2 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[[\"years_since_built\", \"years_since_remodeled\"]].hist(bins=20);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Two factor variables *recently_built* and *recently_remodeled* are created indicating that the corresponding action took place in the last 10 years. The two scatter plots below suggest that these groups of \"recent vs. old\" affect the price."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 93,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df[\"recently_built\"] = df[\"years_since_built\"].apply(lambda x: 1 if x <= 10 else 0)\n",
|
|||
|
"df[\"recently_remodeled\"] = df[\"years_since_remodeled\"].apply(lambda x: 1 if x <= 10 else 0)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 94,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACcSElEQVR4nOydd3hUVfrHP3dmMplJm/RJ74UQEkIndEOvImAXFQtrW+vae117WdlVWV1/tlXprCKChBJ6hxBqQhLSZ9Inbfr8/jiQgFKFiOj9PE8e7py595wzk3Dfe877vt9XcrlcLmRkZGRkZC4gios9ARkZGRmZPx6ycZGRkZGRueDIxkVGRkZG5oIjGxcZGRkZmQuObFxkZGRkZC44qos9gd8L/fr1Izw8/GJPQ0ZGRuaSory8nM2bN/+iXTYuRwkPD2fBggUXexoyMjIylxRTpkw5abu8LSYjIyMjc8GRjYuMjIyMzAVHNi4yMjIyMhcc2eciIyPzp8Vms1FWVobZbL7YU/ndo9FoiIiIwM3N7azOl42LjIzMn5aysjK8vb2JiYlBkqSLPZ3fLS6Xi9raWsrKyoiNjT2ra+RtMRkZmT8tZrOZgIAA2bCcAUmSCAgIOKcVnrxykZGR+UPgcrlYddBIgbGZ/rEBpEf6ntV1smE5O871e5KNi4yMzB+CjYW13PrZNlwuCPZ2Z/HdAwn11V7saf1pkbfFZGRk/hAYTWa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BbHQQkwo2LQBcBNfnCsABU74fqA6c3LnVFsPxJqMq
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"recently_built\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 95,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACc7klEQVR4nOydd3hU1daH36mZ9J5J74UQEkInhGboIEhVUVGxYL2oeFGxF/Ta+70q1/JhV/pVVEoAQ+8QSoCE9N4zadPP98eGBKSIQqR43ueZhzN7ztl7z0w4a/Zea/2WQpIkCRkZGRkZmQuI8mJPQEZGRkbmykM2LjIyMjIyFxzZuMjIyMjIXHBk4yIjIyMjc8GRjYuMjIyMzAVHfbEncKnQp08fgoKCLvY0ZGRkZC4rSkpK2Lp16yntsnE5RlBQEIsXL77Y05CRkZG5rJg4ceJp2+VtMRkZGRmZC45sXGRkZGRkLjiycZGRkZGRueDIPpezYLFYKC4uxmg0XuypyJwFnU5HcHAwGo3mYk9FRkbmGLJxOQvFxcW4uroSHh6OQqG42NOROQ2SJFFTU0NxcTEREREXezoyMjLHkLfFzoLRaMTb21s2LJcwCoUCb29veXUpI3OJIa9cfgfZsFz6yN+RDIhV7NrDleRUNtE3wpukEI+LPaW/NbJxkZGRuSLYnFvD7fN3IEng5+rAsvtSCfBwvNjT+t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X2LhxI+PHjwfEr+/8/HyMRiMjR47Ey8sLAA8PDwA2bdpETk5OWz9NTU00NzcDMGjQILRaLV5eXnh5eVFTU3PWOYwcOZL//Oc/PPLIIyxatOiMyqTHSUtLQ6fT/e48Bg4ciEajITY2FpvNxsCBAwGIjY2luLiYvLw8goOD2xIWJ0yYwFdffUWfPn0IDg4mPDwcgHHjxvH9998DsGHDBtasWcOnn34KgMlkoqys7KT5nemc7du3M23aNAA6depEXFzcWd+njMzvMTzBn+EJ/hd7Glc8snH5Ezg5OQHC5zJjxgyuv/76k17/4osvTnud3W7n+++/x8HB4ZTXtFpt27FKpcJqPbuj0dHRkX79+pGens7PP//8u+UCHB3bQzLPZR5KpRKNRtOWQ6JUKrHZbGcd42y8++67REZGntRWXV39u+fIyMhcnsjRYudB//79WbRoUduv/oqKCmpqaujbty+//PILdXV1ANTX17edf6LhycrKOmv/zs7ObX2fjilTpjB37lwSExNxd3f/Q/P+I/M4kYiICEpKSigoKABg2bJl9OrVi8jISEpKSigsLARg+fLlJ4335ZdftoV/Hjx48LRzOt05vXr14scffwTgyJEjHD58+JznKiMjc/GQjct50L9/f66++mquv/56xo4dy8yZM2lubiYmJoa7776badOmMW7cOF5++WUAnnjiCfbv38/YsWMZPXo033zzzVn79/T0pHv37lx99dW88sorp7zepUsXXFxcfndL7Lf80XmciIODA//617944IEHGDt2LAqFgqlTp+Lg4MDzzz/PjBkzmDBhQtuWIMC9996L1Wpl3LhxjBkzhnfeeeeUfs90ztSpU2lpaWHUqFG8++67JCQk/KH3KiMjc3FQSJKcTQSimtpvt5aysrLaorEuRSoqKrj55pv5+eefOywc+nLhUv+uZGSuVE537wR55XLZsnTpUq699loefPDBv71hkZGRufSQHfqXKePHj2+LUjvOokWL+Pzzz09q6969O88888xfODMZGRmZDjQuubm5PPTQQ23Pi4qKmDlzJuPHj+ehhx6ipKSEoKAg3n77bdzd3ZEkiRdffJFff/0VnU7Hyy+/3La/vmTJEj744AMA7rnnHiZMmADA/v37mTNnD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F+lRvVajVPP/00d9x
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"recently_remodeled\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 96,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"del df[\"Yr Sold\"]\n",
|
|||
|
"del df[\"Year Built\"]\n",
|
|||
|
"del df[\"Year Remod/Add\"]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 97,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"age_columns = [\n",
|
|||
|
" \"remodeled\", \"years_since_built\", \"years_since_remodeled\",\n",
|
|||
|
" \"recently_built\", \"recently_remodeled\",\n",
|
|||
|
"]\n",
|
|||
|
"new_variables.extend(age_columns)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 98,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>remodeled</th>\n",
|
|||
|
" <th>years_since_built</th>\n",
|
|||
|
" <th>years_since_remodeled</th>\n",
|
|||
|
" <th>recently_built</th>\n",
|
|||
|
" <th>recently_remodeled</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>49</td>\n",
|
|||
|
" <td>49</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>52</td>\n",
|
|||
|
" <td>52</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>42</td>\n",
|
|||
|
" <td>42</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>13</td>\n",
|
|||
|
" <td>12</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" remodeled years_since_built years_since_remodeled \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 50 50 \n",
|
|||
|
"2 526350040 0 49 49 \n",
|
|||
|
"3 526351010 0 52 52 \n",
|
|||
|
"4 526353030 0 42 42 \n",
|
|||
|
"5 527105010 1 13 12 \n",
|
|||
|
"\n",
|
|||
|
" recently_built recently_remodeled \n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 \n",
|
|||
|
"2 526350040 0 0 \n",
|
|||
|
"3 526351010 0 0 \n",
|
|||
|
"4 526353030 0 0 \n",
|
|||
|
"5 527105010 0 0 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 98,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df[age_columns].head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Outliers\n",
|
|||
|
"\n",
|
|||
|
"The instructors' notes state:\n",
|
|||
|
"\n",
|
|||
|
"> **Five observations** that an instructor may wish to remove from the data set before giving it to students (a plot of SALE PRICE versus GR LIV AREA will quickly indicate these\n",
|
|||
|
"points). Three of them are true **outliers** (Partial Sales that likely don’t represent actual market values) and two of them are simply unusual sales (very large houses priced\n",
|
|||
|
"relatively appropriately). I would **recommend removing any houses with more than\n",
|
|||
|
"4000 square feet** from the data set (which eliminates these five unusual observations)\n",
|
|||
|
"before assigning it to students.\n",
|
|||
|
"\n",
|
|||
|
"To apply a more \"rigorous\" approach, outlier detection is conducted with a so-called Isolation Forest."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 99,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"# Use only numeric columns that are strongly correlated with the target.\n",
|
|||
|
"# This mitigates the risk that a \"not so good\" chosen factor variable introduced\n",
|
|||
|
"# in this notebook causes an observation to be removed as an outlier.\n",
|
|||
|
"with open(\"data/correlated_variables.json\", \"r\") as file:\n",
|
|||
|
" content = json.loads(file.read())\n",
|
|||
|
"strongly_correlated = content[\"strongly_correlated\"]\n",
|
|||
|
"df_encoded = encode_ordinals(df[list(set(strongly_correlated) & set(df.columns))])\n",
|
|||
|
"iso = IsolationForest(n_estimators=100, bootstrap=True, contamination=0.005)\n",
|
|||
|
"outliers = pd.DataFrame(\n",
|
|||
|
" iso.fit_predict(df_encoded), columns=[\"outlier\"], index=df.index\n",
|
|||
|
")\n",
|
|||
|
"outliers[\"outlier\"] = outliers[\"outlier\"].apply(lambda x: 1 if x < 0 else 0)\n",
|
|||
|
"df = pd.concat([df, outliers], axis=1)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"The five aforementioned outliers are among the ones detected."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 100,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZ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6izjr44Cb4x1DY/1Ff3/Z3y1gIEx6FkXdDVNzFvpsfn4mPgewrvVtkqvDx83D//fdzww03UFdXx9ixY1mwYMF5nQ/6eORit9v5/e9/z+HDhxGJRDz77LNkZmZy33330dzcTEpKCi+++CJarZZQKMQzzzzDunXrUCqV/M///A9FRUUALF68mH/+858A3HnnnVx99dUAVFVVRdocjxs3jkcffRSRSITVaj3tNQSCs6nrcNDl9AFQ29FDc5eLFJ2KzLgocgxRVJt7SNOryUqIOvuJDi4L/wL46FeQPkp4IxZcGKXXhX9f/WR4KkybGg4sx45/S88///wFuLmT9enI5ZlnnmHMmDF89tlnLF26lOzsbObPn095eTkrV66kvLyc+fPnA1BRUUF9fT0rV67kqaee4oknngDAarXy0ksv8cEHH7BgwQJeeuklbLbwp8gnnniCp556ipUrV1JfX09FRQXAGa8hEJxNYbKW/kkxAIzJjSe7N4ik6FX8+5ahvPrzIbz1i2FkxH1NcFFqjn+tSQWpvK9uWfBjVHod3FcFT1jDv59nYOkrfRZcuru72bZtG3PmzAFALpej0WhYvXo1s2bNAmDWrFmsWrUKIHJcJBJRVlaG3W7HbDazYcMGRo0ahU6nQ6vVMmrUKNavX4/ZbMb
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 432x288 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sns.scatterplot(x=\"Gr Liv Area\", y=\"SalePrice\", hue=\"outlier\", s=15, data=df);"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 101,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"# Remove the outliers.\n",
|
|||
|
"df = df[df[\"outlier\"] == 0]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Save the Results"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Save the Data"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 102,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"# Re-order the columns for convenience.\n",
|
|||
|
"final_columns = (\n",
|
|||
|
" sorted(set(list(ALL_COLUMNS.keys()) + new_variables) & set(df.columns))\n",
|
|||
|
" + TARGET_VARIABLES\n",
|
|||
|
")\n",
|
|||
|
"df = df[final_columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Discarding useless and adding new predictors changed the final dataset significantly."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 103,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"(2883, 109)"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 103,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.shape"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 104,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/html": [
|
|||
|
"<div>\n",
|
|||
|
"<style scoped>\n",
|
|||
|
" .dataframe tbody tr th:only-of-type {\n",
|
|||
|
" vertical-align: middle;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe tbody tr th {\n",
|
|||
|
" vertical-align: top;\n",
|
|||
|
" }\n",
|
|||
|
"\n",
|
|||
|
" .dataframe thead th {\n",
|
|||
|
" text-align: right;\n",
|
|||
|
" }\n",
|
|||
|
"</style>\n",
|
|||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|||
|
" <thead>\n",
|
|||
|
" <tr style=\"text-align: right;\">\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th>1st Flr SF</th>\n",
|
|||
|
" <th>1st Flr SF (box-cox-0)</th>\n",
|
|||
|
" <th>2nd Flr SF</th>\n",
|
|||
|
" <th>3Ssn Porch</th>\n",
|
|||
|
" <th>Bedroom AbvGr</th>\n",
|
|||
|
" <th>Bsmt Cond</th>\n",
|
|||
|
" <th>Bsmt Exposure</th>\n",
|
|||
|
" <th>Bsmt Full Bath</th>\n",
|
|||
|
" <th>Bsmt Half Bath</th>\n",
|
|||
|
" <th>Bsmt Qual</th>\n",
|
|||
|
" <th>Bsmt Unf SF</th>\n",
|
|||
|
" <th>BsmtFin SF 1</th>\n",
|
|||
|
" <th>BsmtFin SF 2</th>\n",
|
|||
|
" <th>BsmtFin Type 1</th>\n",
|
|||
|
" <th>BsmtFin Type 2</th>\n",
|
|||
|
" <th>Electrical</th>\n",
|
|||
|
" <th>Enclosed Porch</th>\n",
|
|||
|
" <th>Fence</th>\n",
|
|||
|
" <th>Fireplace Qu</th>\n",
|
|||
|
" <th>Fireplaces</th>\n",
|
|||
|
" <th>Full Bath</th>\n",
|
|||
|
" <th>Functional</th>\n",
|
|||
|
" <th>Garage Area</th>\n",
|
|||
|
" <th>Garage Cars</th>\n",
|
|||
|
" <th>Garage Cond</th>\n",
|
|||
|
" <th>Garage Finish</th>\n",
|
|||
|
" <th>Garage Qual</th>\n",
|
|||
|
" <th>Gr Liv Area</th>\n",
|
|||
|
" <th>Gr Liv Area (box-cox-0)</th>\n",
|
|||
|
" <th>Half Bath</th>\n",
|
|||
|
" <th>Kitchen AbvGr</th>\n",
|
|||
|
" <th>Kitchen Qual</th>\n",
|
|||
|
" <th>Land Slope</th>\n",
|
|||
|
" <th>Lot Area</th>\n",
|
|||
|
" <th>Lot Area (box-cox-0.1)</th>\n",
|
|||
|
" <th>Lot Shape</th>\n",
|
|||
|
" <th>Low Qual Fin SF</th>\n",
|
|||
|
" <th>Mas Vnr Area</th>\n",
|
|||
|
" <th>Misc Val</th>\n",
|
|||
|
" <th>Mo Sold</th>\n",
|
|||
|
" <th>Open Porch SF</th>\n",
|
|||
|
" <th>Overall Cond</th>\n",
|
|||
|
" <th>Overall Qual</th>\n",
|
|||
|
" <th>Paved Drive</th>\n",
|
|||
|
" <th>Pool Area</th>\n",
|
|||
|
" <th>Pool QC</th>\n",
|
|||
|
" <th>Screen Porch</th>\n",
|
|||
|
" <th>TotRms AbvGrd</th>\n",
|
|||
|
" <th>Total Bath</th>\n",
|
|||
|
" <th>Total Bsmt SF</th>\n",
|
|||
|
" <th>Total Porch SF</th>\n",
|
|||
|
" <th>Total SF</th>\n",
|
|||
|
" <th>Total SF (box-cox-0.2)</th>\n",
|
|||
|
" <th>Utilities</th>\n",
|
|||
|
" <th>Wood Deck SF</th>\n",
|
|||
|
" <th>abnormal_sale</th>\n",
|
|||
|
" <th>air_cond</th>\n",
|
|||
|
" <th>build_type_1Fam</th>\n",
|
|||
|
" <th>build_type_2Fam</th>\n",
|
|||
|
" <th>build_type_Twnhs</th>\n",
|
|||
|
" <th>found_BrkTil</th>\n",
|
|||
|
" <th>found_CBlock</th>\n",
|
|||
|
" <th>found_PConc</th>\n",
|
|||
|
" <th>has 2nd Flr</th>\n",
|
|||
|
" <th>has Bsmt</th>\n",
|
|||
|
" <th>has Fireplace</th>\n",
|
|||
|
" <th>has Garage</th>\n",
|
|||
|
" <th>has Pool</th>\n",
|
|||
|
" <th>has Porch</th>\n",
|
|||
|
" <th>major_street</th>\n",
|
|||
|
" <th>new_home</th>\n",
|
|||
|
" <th>nhood_Blmngtn</th>\n",
|
|||
|
" <th>nhood_Blueste</th>\n",
|
|||
|
" <th>nhood_BrDale</th>\n",
|
|||
|
" <th>nhood_BrkSide</th>\n",
|
|||
|
" <th>nhood_ClearCr</th>\n",
|
|||
|
" <th>nhood_CollgCr</th>\n",
|
|||
|
" <th>nhood_Crawfor</th>\n",
|
|||
|
" <th>nhood_Edwards</th>\n",
|
|||
|
" <th>nhood_Gilbert</th>\n",
|
|||
|
" <th>nhood_Greens</th>\n",
|
|||
|
" <th>nhood_GrnHill</th>\n",
|
|||
|
" <th>nhood_IDOTRR</th>\n",
|
|||
|
" <th>nhood_Landmrk</th>\n",
|
|||
|
" <th>nhood_MeadowV</th>\n",
|
|||
|
" <th>nhood_Mitchel</th>\n",
|
|||
|
" <th>nhood_NPkVill</th>\n",
|
|||
|
" <th>nhood_NWAmes</th>\n",
|
|||
|
" <th>nhood_Names</th>\n",
|
|||
|
" <th>nhood_NoRidge</th>\n",
|
|||
|
" <th>nhood_NridgHt</th>\n",
|
|||
|
" <th>nhood_OldTown</th>\n",
|
|||
|
" <th>nhood_SWISU</th>\n",
|
|||
|
" <th>nhood_Sawyer</th>\n",
|
|||
|
" <th>nhood_SawyerW</th>\n",
|
|||
|
" <th>nhood_Somerst</th>\n",
|
|||
|
" <th>nhood_StoneBr</th>\n",
|
|||
|
" <th>nhood_Timber</th>\n",
|
|||
|
" <th>nhood_Veenker</th>\n",
|
|||
|
" <th>park</th>\n",
|
|||
|
" <th>partial_sale</th>\n",
|
|||
|
" <th>railway</th>\n",
|
|||
|
" <th>recently_built</th>\n",
|
|||
|
" <th>recently_remodeled</th>\n",
|
|||
|
" <th>remodeled</th>\n",
|
|||
|
" <th>years_since_built</th>\n",
|
|||
|
" <th>years_since_remodeled</th>\n",
|
|||
|
" <th>SalePrice</th>\n",
|
|||
|
" <th>SalePrice (box-cox-0)</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>Order</th>\n",
|
|||
|
" <th>PID</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>1</th>\n",
|
|||
|
" <th>526301100</th>\n",
|
|||
|
" <td>1656.0</td>\n",
|
|||
|
" <td>7.412160</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>441.0</td>\n",
|
|||
|
" <td>639.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>BLQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>528.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Fin</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1656.0</td>\n",
|
|||
|
" <td>7.412160</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>31770.0</td>\n",
|
|||
|
" <td>18.196923</td>\n",
|
|||
|
" <td>IR1</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>112.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>62.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>P</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>7</td>\n",
|
|||
|
" <td>2.0</td>\n",
|
|||
|
" <td>1080.0</td>\n",
|
|||
|
" <td>272.0</td>\n",
|
|||
|
" <td>2736.0</td>\n",
|
|||
|
" <td>19.344072</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>210.0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>50</td>\n",
|
|||
|
" <td>215000.0</td>\n",
|
|||
|
" <td>12.278393</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>2</th>\n",
|
|||
|
" <th>526350040</th>\n",
|
|||
|
" <td>896.0</td>\n",
|
|||
|
" <td>6.797940</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>270.0</td>\n",
|
|||
|
" <td>468.0</td>\n",
|
|||
|
" <td>144.0</td>\n",
|
|||
|
" <td>Rec</td>\n",
|
|||
|
" <td>LwQ</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>MnPrv</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>730.0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>896.0</td>\n",
|
|||
|
" <td>6.797940</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>11622.0</td>\n",
|
|||
|
" <td>15.499290</td>\n",
|
|||
|
" <td>Reg</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>120.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>1.0</td>\n",
|
|||
|
" <td>882.0</td>\n",
|
|||
|
" <td>260.0</td>\n",
|
|||
|
" <td>1778.0</td>\n",
|
|||
|
" <td>17.333478</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>140.0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>49</td>\n",
|
|||
|
" <td>49</td>\n",
|
|||
|
" <td>105000.0</td>\n",
|
|||
|
" <td>11.561716</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3</th>\n",
|
|||
|
" <th>526351010</th>\n",
|
|||
|
" <td>1329.0</td>\n",
|
|||
|
" <td>7.192182</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>406.0</td>\n",
|
|||
|
" <td>923.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>ALQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>312.0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1329.0</td>\n",
|
|||
|
" <td>7.192182</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>14267.0</td>\n",
|
|||
|
" <td>16.027549</td>\n",
|
|||
|
" <td>IR1</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>108.0</td>\n",
|
|||
|
" <td>12500.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>36.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>1.5</td>\n",
|
|||
|
" <td>1329.0</td>\n",
|
|||
|
" <td>429.0</td>\n",
|
|||
|
" <td>2658.0</td>\n",
|
|||
|
" <td>19.203658</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>393.0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>52</td>\n",
|
|||
|
" <td>52</td>\n",
|
|||
|
" <td>172000.0</td>\n",
|
|||
|
" <td>12.055250</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>4</th>\n",
|
|||
|
" <th>526353030</th>\n",
|
|||
|
" <td>2110.0</td>\n",
|
|||
|
" <td>7.654443</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1045.0</td>\n",
|
|||
|
" <td>1065.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>ALQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>522.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Fin</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>2110.0</td>\n",
|
|||
|
" <td>7.654443</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>Ex</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>11160.0</td>\n",
|
|||
|
" <td>15.396064</td>\n",
|
|||
|
" <td>Reg</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>4</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>7</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>8</td>\n",
|
|||
|
" <td>3.5</td>\n",
|
|||
|
" <td>2110.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>4220.0</td>\n",
|
|||
|
" <td>21.548042</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>42</td>\n",
|
|||
|
" <td>42</td>\n",
|
|||
|
" <td>244000.0</td>\n",
|
|||
|
" <td>12.404924</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5</th>\n",
|
|||
|
" <th>527105010</th>\n",
|
|||
|
" <td>928.0</td>\n",
|
|||
|
" <td>6.833032</td>\n",
|
|||
|
" <td>701.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>No</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>Gd</td>\n",
|
|||
|
" <td>137.0</td>\n",
|
|||
|
" <td>791.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>GLQ</td>\n",
|
|||
|
" <td>Unf</td>\n",
|
|||
|
" <td>SBrkr</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>MnPrv</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>Typ</td>\n",
|
|||
|
" <td>482.0</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Fin</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>1629.0</td>\n",
|
|||
|
" <td>7.395722</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>TA</td>\n",
|
|||
|
" <td>Gtl</td>\n",
|
|||
|
" <td>13830.0</td>\n",
|
|||
|
" <td>15.946705</td>\n",
|
|||
|
" <td>IR1</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>34.0</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>5</td>\n",
|
|||
|
" <td>Y</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>NA</td>\n",
|
|||
|
" <td>0.0</td>\n",
|
|||
|
" <td>6</td>\n",
|
|||
|
" <td>2.5</td>\n",
|
|||
|
" <td>928.0</td>\n",
|
|||
|
" <td>246.0</td>\n",
|
|||
|
" <td>2557.0</td>\n",
|
|||
|
" <td>19.016856</td>\n",
|
|||
|
" <td>AllPub</td>\n",
|
|||
|
" <td>212.0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>13</td>\n",
|
|||
|
" <td>12</td>\n",
|
|||
|
" <td>189900.0</td>\n",
|
|||
|
" <td>12.154253</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" 1st Flr SF 1st Flr SF (box-cox-0) 2nd Flr SF 3Ssn Porch \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1656.0 7.412160 0.0 0.0 \n",
|
|||
|
"2 526350040 896.0 6.797940 0.0 0.0 \n",
|
|||
|
"3 526351010 1329.0 7.192182 0.0 0.0 \n",
|
|||
|
"4 526353030 2110.0 7.654443 0.0 0.0 \n",
|
|||
|
"5 527105010 928.0 6.833032 701.0 0.0 \n",
|
|||
|
"\n",
|
|||
|
" Bedroom AbvGr Bsmt Cond Bsmt Exposure Bsmt Full Bath \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 3 Gd Gd 1 \n",
|
|||
|
"2 526350040 2 TA No 0 \n",
|
|||
|
"3 526351010 3 TA No 0 \n",
|
|||
|
"4 526353030 3 TA No 1 \n",
|
|||
|
"5 527105010 3 TA No 0 \n",
|
|||
|
"\n",
|
|||
|
" Bsmt Half Bath Bsmt Qual Bsmt Unf SF BsmtFin SF 1 \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 TA 441.0 639.0 \n",
|
|||
|
"2 526350040 0 TA 270.0 468.0 \n",
|
|||
|
"3 526351010 0 TA 406.0 923.0 \n",
|
|||
|
"4 526353030 0 TA 1045.0 1065.0 \n",
|
|||
|
"5 527105010 0 Gd 137.0 791.0 \n",
|
|||
|
"\n",
|
|||
|
" BsmtFin SF 2 BsmtFin Type 1 BsmtFin Type 2 Electrical \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0.0 BLQ Unf SBrkr \n",
|
|||
|
"2 526350040 144.0 Rec LwQ SBrkr \n",
|
|||
|
"3 526351010 0.0 ALQ Unf SBrkr \n",
|
|||
|
"4 526353030 0.0 ALQ Unf SBrkr \n",
|
|||
|
"5 527105010 0.0 GLQ Unf SBrkr \n",
|
|||
|
"\n",
|
|||
|
" Enclosed Porch Fence Fireplace Qu Fireplaces Full Bath \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0.0 NA Gd 2 1 \n",
|
|||
|
"2 526350040 0.0 MnPrv NA 0 1 \n",
|
|||
|
"3 526351010 0.0 NA NA 0 1 \n",
|
|||
|
"4 526353030 0.0 NA TA 2 2 \n",
|
|||
|
"5 527105010 0.0 MnPrv TA 1 2 \n",
|
|||
|
"\n",
|
|||
|
" Functional Garage Area Garage Cars Garage Cond \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Typ 528.0 2 TA \n",
|
|||
|
"2 526350040 Typ 730.0 1 TA \n",
|
|||
|
"3 526351010 Typ 312.0 1 TA \n",
|
|||
|
"4 526353030 Typ 522.0 2 TA \n",
|
|||
|
"5 527105010 Typ 482.0 2 TA \n",
|
|||
|
"\n",
|
|||
|
" Garage Finish Garage Qual Gr Liv Area \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 Fin TA 1656.0 \n",
|
|||
|
"2 526350040 Unf TA 896.0 \n",
|
|||
|
"3 526351010 Unf TA 1329.0 \n",
|
|||
|
"4 526353030 Fin TA 2110.0 \n",
|
|||
|
"5 527105010 Fin TA 1629.0 \n",
|
|||
|
"\n",
|
|||
|
" Gr Liv Area (box-cox-0) Half Bath Kitchen AbvGr \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 7.412160 0 1 \n",
|
|||
|
"2 526350040 6.797940 0 1 \n",
|
|||
|
"3 526351010 7.192182 1 1 \n",
|
|||
|
"4 526353030 7.654443 1 1 \n",
|
|||
|
"5 527105010 7.395722 1 1 \n",
|
|||
|
"\n",
|
|||
|
" Kitchen Qual Land Slope Lot Area Lot Area (box-cox-0.1) \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 TA Gtl 31770.0 18.196923 \n",
|
|||
|
"2 526350040 TA Gtl 11622.0 15.499290 \n",
|
|||
|
"3 526351010 Gd Gtl 14267.0 16.027549 \n",
|
|||
|
"4 526353030 Ex Gtl 11160.0 15.396064 \n",
|
|||
|
"5 527105010 TA Gtl 13830.0 15.946705 \n",
|
|||
|
"\n",
|
|||
|
" Lot Shape Low Qual Fin SF Mas Vnr Area Misc Val Mo Sold \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 IR1 0.0 112.0 0.0 5 \n",
|
|||
|
"2 526350040 Reg 0.0 0.0 0.0 6 \n",
|
|||
|
"3 526351010 IR1 0.0 108.0 12500.0 6 \n",
|
|||
|
"4 526353030 Reg 0.0 0.0 0.0 4 \n",
|
|||
|
"5 527105010 IR1 0.0 0.0 0.0 3 \n",
|
|||
|
"\n",
|
|||
|
" Open Porch SF Overall Cond Overall Qual Paved Drive \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 62.0 5 6 P \n",
|
|||
|
"2 526350040 0.0 6 5 Y \n",
|
|||
|
"3 526351010 36.0 6 6 Y \n",
|
|||
|
"4 526353030 0.0 5 7 Y \n",
|
|||
|
"5 527105010 34.0 5 5 Y \n",
|
|||
|
"\n",
|
|||
|
" Pool Area Pool QC Screen Porch TotRms AbvGrd Total Bath \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0.0 NA 0.0 7 2.0 \n",
|
|||
|
"2 526350040 0.0 NA 120.0 5 1.0 \n",
|
|||
|
"3 526351010 0.0 NA 0.0 6 1.5 \n",
|
|||
|
"4 526353030 0.0 NA 0.0 8 3.5 \n",
|
|||
|
"5 527105010 0.0 NA 0.0 6 2.5 \n",
|
|||
|
"\n",
|
|||
|
" Total Bsmt SF Total Porch SF Total SF \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1080.0 272.0 2736.0 \n",
|
|||
|
"2 526350040 882.0 260.0 1778.0 \n",
|
|||
|
"3 526351010 1329.0 429.0 2658.0 \n",
|
|||
|
"4 526353030 2110.0 0.0 4220.0 \n",
|
|||
|
"5 527105010 928.0 246.0 2557.0 \n",
|
|||
|
"\n",
|
|||
|
" Total SF (box-cox-0.2) Utilities Wood Deck SF \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 19.344072 AllPub 210.0 \n",
|
|||
|
"2 526350040 17.333478 AllPub 140.0 \n",
|
|||
|
"3 526351010 19.203658 AllPub 393.0 \n",
|
|||
|
"4 526353030 21.548042 AllPub 0.0 \n",
|
|||
|
"5 527105010 19.016856 AllPub 212.0 \n",
|
|||
|
"\n",
|
|||
|
" abnormal_sale air_cond build_type_1Fam build_type_2Fam \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 1 1 0 \n",
|
|||
|
"2 526350040 0 1 1 0 \n",
|
|||
|
"3 526351010 0 1 1 0 \n",
|
|||
|
"4 526353030 0 1 1 0 \n",
|
|||
|
"5 527105010 0 1 1 0 \n",
|
|||
|
"\n",
|
|||
|
" build_type_Twnhs found_BrkTil found_CBlock found_PConc \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 1 0 \n",
|
|||
|
"2 526350040 0 0 1 0 \n",
|
|||
|
"3 526351010 0 0 1 0 \n",
|
|||
|
"4 526353030 0 0 1 0 \n",
|
|||
|
"5 527105010 0 0 0 1 \n",
|
|||
|
"\n",
|
|||
|
" has 2nd Flr has Bsmt has Fireplace has Garage has Pool \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 1 1 1 0 \n",
|
|||
|
"2 526350040 0 1 0 1 0 \n",
|
|||
|
"3 526351010 0 1 0 1 0 \n",
|
|||
|
"4 526353030 0 1 1 1 0 \n",
|
|||
|
"5 527105010 1 1 1 1 0 \n",
|
|||
|
"\n",
|
|||
|
" has Porch major_street new_home nhood_Blmngtn \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1 0 0 0 \n",
|
|||
|
"2 526350040 1 1 0 0 \n",
|
|||
|
"3 526351010 1 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 1 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_Blueste nhood_BrDale nhood_BrkSide nhood_ClearCr \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_CollgCr nhood_Crawfor nhood_Edwards nhood_Gilbert \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 1 \n",
|
|||
|
"\n",
|
|||
|
" nhood_Greens nhood_GrnHill nhood_IDOTRR nhood_Landmrk \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_MeadowV nhood_Mitchel nhood_NPkVill nhood_NWAmes \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_Names nhood_NoRidge nhood_NridgHt nhood_OldTown \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 1 0 0 0 \n",
|
|||
|
"2 526350040 1 0 0 0 \n",
|
|||
|
"3 526351010 1 0 0 0 \n",
|
|||
|
"4 526353030 1 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_SWISU nhood_Sawyer nhood_SawyerW nhood_Somerst \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" nhood_StoneBr nhood_Timber nhood_Veenker park \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" partial_sale railway recently_built recently_remodeled \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 0 0 0 \n",
|
|||
|
"2 526350040 0 0 0 0 \n",
|
|||
|
"3 526351010 0 0 0 0 \n",
|
|||
|
"4 526353030 0 0 0 0 \n",
|
|||
|
"5 527105010 0 0 0 0 \n",
|
|||
|
"\n",
|
|||
|
" remodeled years_since_built years_since_remodeled \\\n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 0 50 50 \n",
|
|||
|
"2 526350040 0 49 49 \n",
|
|||
|
"3 526351010 0 52 52 \n",
|
|||
|
"4 526353030 0 42 42 \n",
|
|||
|
"5 527105010 1 13 12 \n",
|
|||
|
"\n",
|
|||
|
" SalePrice SalePrice (box-cox-0) \n",
|
|||
|
"Order PID \n",
|
|||
|
"1 526301100 215000.0 12.278393 \n",
|
|||
|
"2 526350040 105000.0 11.561716 \n",
|
|||
|
"3 526351010 172000.0 12.055250 \n",
|
|||
|
"4 526353030 244000.0 12.404924 \n",
|
|||
|
"5 527105010 189900.0 12.154253 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 104,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.head()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 105,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"df.to_csv(\"data/data_clean_with_transformations_and_factors.csv\")"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"kernelspec": {
|
|||
|
"display_name": "Python 3",
|
|||
|
"language": "python",
|
|||
|
"name": "python3"
|
|||
|
},
|
|||
|
"language_info": {
|
|||
|
"codemirror_mode": {
|
|||
|
"name": "ipython",
|
|||
|
"version": 3
|
|||
|
},
|
|||
|
"file_extension": ".py",
|
|||
|
"mimetype": "text/x-python",
|
|||
|
"name": "python",
|
|||
|
"nbconvert_exporter": "python",
|
|||
|
"pygments_lexer": "ipython3",
|
|||
|
"version": "3.8.5"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 4
|
|||
|
}
|