text_html_output_1.png text_plain_output_1.png
import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

train_df = pd.read_csv('../input/train.csv')
test_df = pd.read_csv('../input/test.csv')
sub_df = pd.read_csv('../input/sample_submission.csv')

train_df.columns

train_df.dtypes

(train_df.isnull().sum() / 1460 * 100).iloc[0:50]

(test_df.isnull().sum() / 1460 * 100).iloc[50:82]

test_df.drop(['Id', 'PoolQC', 'Fence', 'MiscFeature', 'FireplaceQu', 'Alley'], axis=1).head()
train_df.drop(['Id', 'PoolQC', 'Fence', 'MiscFeature', 'FireplaceQu', 'Alley'], axis=1).head()

num_attributes = train_df[['MSSubClass', 'LotFrontage', 'LotArea', 'OverallQual', 'OverallCond', 'YearBuilt', 'YearRemodAdd', 'MasVnrArea', 'BsmtFinSF1', 'BsmtFinSF2', 'BsmtUnfSF', 'TotalBsmtSF', '1stFlrSF', '2ndFlrSF', 'LowQualFinSF', 'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath', 'HalfBath', 'BedroomAbvGr', 'KitchenQual', 'TotRmsAbvGrd', 'Fireplaces', 'GarageYrBlt', 'GarageCars', 'GarageArea', 'WoodDeckSF', 'OpenPorchSF', 'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'MiscVal', 'MoSold', 'YrSold', 'SalePrice']]
corr = num_attributes.corr()
mask = np.zeros_like(corr, dtype=np.bool)
mask[np.triu_indices_from(mask)] = True
cmap = sns.diverging_palette(220, 10, as_cmap=True)
sns.heatmap(corr, mask=mask, cmap=cmap, vmin=-0.4, vmax=0.4, center=0, square=True, linewidths=0.5, cbar_kws={'shrink': 0.5})