text_plain_output_1.png
from scipy import stats

from scipy.stats import norm, skew # for some statistics

from sklearn.datasets import load_boston

import matplotlib.pyplot as plt

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

import seaborn as sns

from sklearn.datasets import load_boston
load_boston = load_boston()
x = load_boston.data
y = load_boston.target
data = pd.DataFrame(x, columns=load_boston.feature_names)
data['SalePrice'] = y

data.isnull().sum()

plt.tight_layout()

fig, ax = plt.subplots()
ax.scatter(x = data["CRIM"], y = data["SalePrice"])
plt.ylabel("SalesPrice", fontsize = 13)
plt.xlabel("CRIM", fontsize = 13)
plt.show()

fig, ax = plt.subplots()
ax.scatter(x = data["AGE"], y = data["SalePrice"])
plt.ylabel("SalesPrice", fontsize = 13)
plt.xlabel("AGE", fontsize = 13)
plt.show()

from scipy import stats
from scipy.stats import norm, skew # for some statistics

sns.distplot(data["SalePrice"], fit = norm)

(mu, sigma) = norm.fit(data["SalePrice"])
print("\n mu = {:.2f} and sigma = {:.2f}\n".format(mu, sigma))

plt.legend(["Normal dist. ($\mu=$ {:.2f})".format(mu, sigma)],loc = "best") #loc is mean and scale is standard deviation
plt.ylabel("Frequency")
plt.title("Saleprice distribution")

# Get also the QQ - plot quardrant quartiles
fig = plt.figure()
res = stats.probplot(data["SalePrice"], plot = plt)
plt.show()

plt.figure(figsize=(10, 10))
cor = data.corr()
sns.heatmap(cor, annot=True, cmap=plt.cm.PuBu)
plt.show()