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

train = pd.read_csv('../input/train-dataset/train.csv')
train.shape

train.drop(columns=['Id'], inplace=True)

missing_cols = train.isna().sum()
missing_cols = missing_cols[missing_cols != 0]
missing_cols.sort_values(ascending=False)

train.drop(columns=['PoolQC', 'MiscFeature', 'Alley', 'Fence'], inplace=True)

missing_cols = train.isna().sum()
missing_cols = missing_cols[missing_cols != 0]
missing_cols.sort_values(ascending=False)

missing_cols = train.isna().sum()
missing_cols = missing_cols[missing_cols != 0]
newList = list(missing_cols.index)
newList.append('SalePrice')
train[newList].corr()

cols_to_be_removed = ['LotFrontage', 'GarageYrBlt', 'MasVnrArea']
train.drop(columns=cols_to_be_removed, inplace=True)

missing_cols = train.isna().sum()
missing_cols = missing_cols[missing_cols != 0]
missing_cols.sort_values(ascending=False)

missing_cols = train.isna().sum()
missing_cols = missing_cols[missing_cols != 0]
missing_cols.sort_values(ascending=False)

missing_cols = train.isna().sum()
missing_cols = missing_cols[missing_cols != 0]
print(f'No. of columns with missing values: {len(missing_cols)}')
missing_cols.sort_values(ascending=False)