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

train = pd.read_csv('../input/train/Train.csv', header=0)

train.Outlet_Establishment_Year = 2013 - train.Outlet_Establishment_Year
train['Outlet_Establishment_Year'].value_counts()

test = pd.read_csv('../input/testpr-a102/Test.csv', header=0)
test.shape

test.Outlet_Establishment_Year = 2013 - test.Outlet_Establishment_Year
test.Outlet_Establishment_Year.value_counts()

train.isnull().sum()

test.isnull().sum()

train[train.Item_Weight.isnull()]

train[train.Outlet_Size.isnull()]

train.groupby('Outlet_Type').Outlet_Size.value_counts(dropna=False)

test[test.Item_Weight.isnull()]

test[test.Outlet_Size.isnull()]

train.groupby('Item_Type').Item_Fat_Content.value_counts(dropna=False)

train_1 = train.dropna(subset=['Item_Weight'])
train_mean = train.fillna(value=train_1['Item_Weight'].mean())
test_1 = test.dropna(subset=['Item_Weight'])
test_mean = test.fillna(value=test_1['Item_Weight'].mean())

train_2 = train.dropna(subset=['Item_Weight'])
train_median = train.fillna(value=train_2['Item_Weight'].median())
test_2 = test.dropna(subset=['Item_Weight'])
test_median = train.fillna(value=train_2['Item_Weight'].median())

train_3 = train.dropna(subset=['Item_Weight'])
train_mode = train.fillna(value=train_3['Item_Weight'].mode())
test_3 = test.dropna(subset=['Item_Weight'])
test_mode = test.fillna(value=test_3['Item_Weight'].mode())

test_mode.head()