text_html_output_1.png
import matplotlib.pyplot as plt

import missingno as msno

import numpy as np

import numpy as np # linear algebra

import pandas as pd

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

import seaborn as sns

pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', 20)

test = pd.read_csv('../input/house-prices-advanced-regression-techniques/test.csv')
train = pd.read_csv('../input/house-prices-advanced-regression-techniques/train.csv')

train.shape

train = train.drop(['Id'], axis=1)

missingdata_df = train.columns[train.isnull().any()].tolist()
msno.matrix(train[missingdata_df])

target = np.log(train['SalePrice'])
target.skew()

train = train.drop(['PoolQC', 'MiscFeature', 'Alley', 'Fence', 'FireplaceQu'], axis=1)

numeric_data = train.select_dtypes(include=[np.number])
categorical_data = train.select_dtypes(exclude=[np.number])

# Compute the correlation matrix
corr = numeric_data.corr()

# Generate a mask for the upper triangle
mask = np.triu(np.ones_like(corr, dtype=np.bool))

# Set up the matplotlib figure
f, ax = plt.subplots(figsize=(11, 9))
plt.title('Correlation of Numeric Features',y=1,size=16)

# Generate a custom diverging colormap
cmap = sns.diverging_palette(220, 10, as_cmap=True)

# Draw the heatmap with the mask and correct aspect ratio
sns.heatmap(corr, mask=mask, cmap=cmap, vmax=.3, center=0,
            square=True, linewidths=.5, cbar_kws={"shrink": .5})

correlation = numeric_data.corr()
print(correlation['SalePrice'].sort_values(ascending=False), '\n')