Ejemplo n.º 1
0
def _F_LabelCount():
    if os.path.exists(data_path + "data/_F_d_label_count.feather"):
        df = feather.read_dataframe(data_path +
                                    "data/_F_d_label_count.feather")
        return df

    temp = pd.DataFrame()
    temp[pri_id] = pd.concat((_train[pri_id], _test[pri_id]))

    # trans_type1
    temp = temp.merge(_F.DangerousLabel(trans_info, pri_id, 'trans_type1',
                                        'ced62357ad496957', 0.8),
                      on=pri_id,
                      how='left')

    # trans_type2
    temp = temp.merge(_F.DangerousLabel(trans_info, pri_id, 'trans_type2', 104,
                                        0.8),
                      on=pri_id,
                      how='left')

    # amt_src1
    temp = temp.merge(_F.DangerousLabel(trans_info, pri_id, 'amt_src1',
                                        'c4ec9622cf5c6e55', 0.8),
                      on=pri_id,
                      how='left')

    # amt_src2
    temp = temp.merge(_F.DangerousLabel(trans_info, pri_id, 'amt_src2',
                                        'c4ec9622cf5c6e55', 0.8),
                      on=pri_id,
                      how='left')
    feather.write_dataframe(temp, data_path + "data/_F_d_label_count.feather")

    return temp