python - The exhaustive parameter search in dataframe -
there dataframe in line of credit history. history of repeated , differ source of information. need leave 1 string each application selecting reliable source.the metric of reliability is.but method used busting long. please tell me method how faster of these 2 records should one.the 1 less value of field percent
idunique = df_train.id.unique() columns = list(df_train.columns) df_res = pd.dataframe() r in range(len(idunique)): x_train = df_train[df_train['id']==idunique[r]] dtimes = x_train['dtime_credit'].unique() ix in range(len(dtimes)): x_train2 = x_train[x_train['dtime_credit']==dtimes[ix]] if x_train2.shape[0]>1: in range(len(columns)): x_train2[columns[i]].replace(np.nan,x_train2[columns[i]].mean(),regex=true,inplace=true) toappend = x_train2[x_train2['percent']==x_train2['percent'].min()] if toappend.shape[0]>1: toappend = toappend.iloc[0:1] else: toappend = x_train2 df_res =df_res.append(toappend)
Comments
Post a Comment