data[‘Gender’].fillna(data[‘Gender’].mode().iloc[0],inplace=True)
data[‘Married’].fillna(data[‘Married’].mode().iloc[0],inplace=True)
data[‘Self_Employed’].fillna(data[‘Self_Employed’].mode().iloc[0],inplace=True)
data[‘Gender’].fillna(data[‘Gender’].iloc[0])
impute_grps = data.pivot_table(values=[“LoanAmount”],index=[“Gender”,“Married”,“Self_Employed”],aggfunc=np.mean)
for i,row in data.loc[data[‘LoanAmount’].isnull(),:].iterrows():
ind = tuple ([row[‘Gender’],row[‘Married’],row[‘Self_Employed’]])
data.loc[i,‘LoanAmount’] = impute_grps.loc[ind].values[0]
data_merged = data.merge(right=prop_rates,how=‘inner’,left_on=‘Property_Area’,right_index=True,sort=False)
data_merged.pivot_table(values=‘Credit_History’,index=[‘Property_Area’,‘rates’],aggfunc=len)
cut_points = [90,140,190]
break_points = [data[‘LoanAmount’].min()] + cut_poi