image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sb

df = pd.read_csv('../input/kc_house_data.csv')

#df correlation matrix
f,ax = plt.subplots(figsize=(12, 9))
sb.heatmap(df.corr(), annot=True, linewidths=.5, fmt='.1f', ax=ax)

sb.set()
cols = df[['price', 'sqft_living', 'grade', 'sqft_above', 'bathrooms', 'sqft_living15']]

#saleprice correlation matrix
k = 10 #number of variables for heatmap
corrmat = df.corr()
cols = corrmat.nlargest(k, 'price')['price'].index
cm = np.corrcoef(df[cols].values.T)
sb.set(font_scale=1.25)
hm = sb.heatmap(cm, cbar=True, annot=True, square=True, fmt='.2f', annot_kws={'size': 10}, yticklabels=cols.values, xticklabels=cols.values)
plt.show()

var = 'sqft_living'
data = pd.concat([df['price'], df[var]], axis=1)

#boxplot 'grade'/'price'
var1 = 'grade'
data = pd.concat([df['price'], df[var1]], axis=1)
f, ax = plt.subplots(figsize=(8, 6))
fig = sb.boxplot(x=var1, y="price", data=data)
fig.axis(ymin=0, ymax=8000000);

var2 = 'sqft_living15'
data = pd.concat([df['price'], df[var2]], axis=1)

var3 = 'sqft_above'
data = pd.concat([df['price'], df[var3]], axis=1)

var4 = 'bathrooms'
data = pd.concat([df['price'], df[var4]], axis=1)
data.plot.scatter(x=var4, y='price', ylim=(0, 8000000))