image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

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

train_data.shape

fig = plt.figure(figsize=(10,5))
sns.distplot(train_data['SalePrice'])
plt.tight_layout()
plt.show()

fig = plt.figure(figsize=(10,5))
sns.distplot(np.log1p(train_data['SalePrice']))
plt.tight_layout()
plt.show()

cat_data = train_data.select_dtypes(include='object')
cat_cols = cat_data.columns
num_data = train_data.select_dtypes(exclude='object')
num_cols = num_data.columns
num_to_cat_cols = ['MSSubClass', 'MoSold', 'YrSold', 'OverallQual', 'OverallCond']
num_cols = [i for i in num_cols if not i in num_to_cat_cols]
num_cols = [i for i in num_cols if not i in ['Id']]
num_data = num_data.drop(['Id', 'MSSubClass', 'MoSold', 'YrSold', 'OverallQual', 'OverallCond'], axis=1)

for i in range(len(cat_data.columns)):
    f, ax = plt.subplots(figsize=(7, 4))
    fig = sns.countplot(cat_data.iloc[:,i].dropna())
    plt.xlabel(cat_data.columns[i])
    plt.xticks(rotation=60)

for i in range(len(num_data.columns)):
    f, ax = plt.subplots(figsize=(7, 4))
    fig = sns.distplot(num_data.iloc[:, i].dropna(), rug=False, hist=False, kde_kws={'bw': 0.1})
    plt.xlabel(num_data.columns[i])