text_plain_output_1.png
import numpy as np

import pandas as pd

train = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')

np.array(list(zip(train.Id, train.columns)))

np.array(list(zip(train.Id, train.columns[train.isnull().any()].tolist())))

np.array(list(zip(train.Id, test.columns[test.isnull().any()].tolist())))

trainNum = train.select_dtypes(include=[np.number])
trainCat = train.select_dtypes(include=[object])
testNum = test.select_dtypes(include=[np.number])
testCat = test.select_dtypes(include=[object])

np.array(list(zip(train.Id, trainCat.columns[trainCat.isnull().any()].tolist())))

np.array(list(zip(train.Id, test.columns[test.isnull().any()].tolist())))

np.array(list(zip(train.Id, testNum.columns[testNum.isnull().any()].tolist())))

testNum['BsmtFinSF1'].fillna(testNum['BsmtFinSF1'].mean(), inplace=True)
testNum['BsmtFinSF2'].fillna(testNum['BsmtFinSF2'].mean(), inplace=True)
testNum['BsmtUnfSF'].fillna(testNum['BsmtUnfSF'].mean(), inplace=True)
testNum['TotalBsmtSF'].fillna(testNum['TotalBsmtSF'].mean(), inplace=True)
testNum['BsmtFullBath'].fillna(testNum['BsmtFullBath'].mean(), inplace=True)
testNum['BsmtHalfBath'].fillna(testNum['BsmtHalfBath'].mean(), inplace=True)
testNum['GarageCars'].fillna(testNum['GarageCars'].mean(), inplace=True)
testNum['GarageArea'].fillna(testNum['GarageArea'].mean(), inplace=True)
testNum['LotFrontage'].fillna(testNum['LotFrontage'].mean(), inplace=True)
testNum['MasVnrArea'].fillna(testNum['MasVnrArea'].mean(), inplace=True)
testNum['GarageYrBlt'].fillna(testNum['GarageYrBlt'].value_counts().idxmax(), inplace=True)