text_plain_output_1.png
import os

import pandas as pd

dataset_path = '/kaggle/input/house-prices-advanced-regression-techniques/'
train = pd.read_csv(os.path.join(dataset_path, 'train.csv'))

train.drop_duplicates(inplace=True)

test = pd.read_csv(os.path.join(dataset_path, 'test.csv'))

[col for col in train.columns if train[col].isnull().sum() != 0]

missing_val_count_by_column = train.isnull().sum()

[col for col in test.columns if test[col].isnull().sum() != 0]

missing_val_count_by_column = test.isnull().sum()

Id = test['Id']
test.drop(['Id', 'Alley', 'PoolQC', 'Fence', 'MiscFeature', 'FireplaceQu'], axis=1, inplace=True)
test.shape

X_train['BsmtQual'].fillna('No Basement', inplace=True)
X_train['BsmtCond'].fillna('No Basement', inplace=True)
X_train['BsmtExposure'].fillna('No Basement', inplace=True)
X_train['BsmtFinType1'].fillna('No Basement', inplace=True)
X_train['BsmtFinType2'].fillna('No Basement', inplace=True)
X_train['GarageType'].fillna('No Garage', inplace=True)
X_train['GarageFinish'].fillna('No Garage', inplace=True)
X_train['GarageQual'].fillna('No Garage', inplace=True)
X_train['GarageCond'].fillna('No Garage', inplace=True)
X_valid['BsmtQual'].fillna('No Basement', inplace=True)
X_valid['BsmtCond'].fillna('No Basement', inplace=True)
X_valid['BsmtExposure'].fillna('No Basement', inplace=True)
X_valid['BsmtFinType1'].fillna('No Basement', inplace=True)
X_valid['BsmtFinType2'].fillna('No Basement', inplace=True)
X_valid['GarageType'].fillna('No Garage', inplace=True)
X_valid['GarageFinish'].fillna('No Garage', inplace=True)
X_valid['GarageQual'].fillna('No Garage', inplace=True)
X_valid['GarageCond'].fillna('No Garage', inplace=True)
test['BsmtQual'].fillna('No Basement', inplace=True)
test['BsmtCond'].fillna('No Basement', inplace=True)
test['BsmtExposure'].fillna('No Basement', inplace=True)
test['BsmtFinType1'].fillna('No Basement', inplace=True)
test['BsmtFinType2'].fillna('No Basement', inplace=True)
test['GarageType'].fillna('No Garage', inplace=True)
test['GarageFinish'].fillna('No Garage', inplace=True)
test['GarageQual'].fillna('No Garage', inplace=True)
test['GarageCond'].fillna('No Garage', inplace=True)