Kaggle competition: Home Credit Default Risk
df['densidade_dem']=[float(i)for i in [i.replace(',','')for i in [str(i)for i in df['densidade_dem']]]]<feature_engineering>
M1 = pd.read_csv('.. /input/gogomaster/Think1.csv')
 M2 = pd.read_csv('.. /input/gogomaster/11111.csv')
 M3 = pd.read_csv('.. /input/gogomaster/22222.csv')
 M4 = pd.read_csv('.. /input/gogomaster/33333.csv')
 M5 = pd.read_csv('.. /input/gogomaster/44444.csv')
 M6 = pd.read_csv('.. /input/gogomaster/55555.csv' )
test['area']=[float(a)for a in [i.replace(',','')for i in list(test['area'].values)]]<feature_engineering>
def merge_dataframes(dfs, merge_keys):
dfs_merged = reduce(lambda left,right: pd.merge(left, right, on=merge_keys), dfs)
 return dfs_merged
test['densidade_dem']=[float(i)for i in [i.replace(',','')for i in [str(i)for i in test['densidade_dem']]]]<count_missing_values>
dfs = [M1,M2,M3,M4,M5,M6]
merge_keys=['SK_ID_CURR']
df = merge_dataframes(dfs, merge_keys=merge_keys )
test['ranking_igm'].isnull().sum() ,sum(test['ranking_igm'].isnull() ==False )<define_variables>
df.columns = ['SK_ID_CURR','T1','T2','T3','T4','T5','T6']
df.head()
feats=[a for a in df.columns if a not in ['nota_mat']+d]<data_type_conversions>
pred_prob = 0.7 * df['T3'] + 0.3 * df['T1']
pred_prob.head()
for i in df[feats].columns:
if df[i].isnull().sum() >0:
if df[i].dtypes!='object':
df[i]=df[i].fillna(df[i].mean())
 else:
continue
else:
continue<count_missing_values>
sub = pd.DataFrame()
sub['SK_ID_CURR'] = df['SK_ID_CURR']
sub['target']= pred_prob
df[feats].isnull().sum()<data_type_conversions>
sub.to_csv('ldit.csv', index=False )
for i in test[feats].columns:
if test[i].isnull().sum() >0:
if test[i].dtypes!='object':
test[i]=test[i].fillna(test[i].mean())
 else:
continue
else:
continue<count_missing_values>
B_prob = 0.6 * df['T3'] + 0.2 * df['T1'] + 0.2 * df['T2']
df.loc[:,feats].isnull().sum()<feature_engineering>
SUB = pd.DataFrame()
SUB['SK_ID_CURR'] = df['SK_ID_CURR']
SUB['TARGET'] = B_prob
SUB.to_csv('Blendss.csv', index=False )
for i in range(0,len(df.columns)) :
df[df.columns[i]] = np.log(df[df.columns[i]] + 1 )<feature_engineering>
corr_pred = 0.6 * df['T2'] + 0.05 * df['T3'] + 0.05 * df['T4'] + 0.1 * df['T5'] + 0.2 * df['T1']
corr_pred.head()
<import_modules><EOS> 
SuB = pd.DataFrame()
SuB['SK_ID_CURR'] = df['SK_ID_CURR']
SuB['TARGET'] = corr_pred
SuB.to_csv('corr_blend.csv', index=False )