def to_dummpy(data, code, qqlist=None, qtype_new='多选题', ignore_open=True):
    '转化成哑变量\n    将数据中所有的单选题全部转化成哑变量，另外剔除掉开放题和填空题\n    返回一个很大的只有0和1的数据\n    '
    if (qqlist is None):
        qqlist = sorted(code, key=(lambda x: int(re.findall('\\d+', x)[0])))
    bdata = pd.DataFrame()
    bcode = {}
    for qq in qqlist:
        qtype = code[qq]['qtype']
        data0 = data[code[qq]['qlist']]
        if (qtype == '单选题'):
            data0 = data0.iloc[:, 0]
            categorys = data0[data0.notnull()].unique()
            try:
                categorys = sorted(categorys)
            except:
                pass
            categorys = [t for t in categorys if (t in code[qq]['code'])]
            cname = [code[qq]['code'][k] for k in categorys]
            columns_name = ['{}_A{}'.format(qq, (i + 1)) for i in range(len(categorys))]
            tmp = pd.DataFrame(index=data0.index, columns=columns_name)
            for (i, c) in enumerate(categorys):
                tmp[columns_name[i]] = data0.map((lambda x: int((x == c))))
            code_tmp = {'content': code[qq]['content'], 'qtype': qtype_new}
            code_tmp['code'] = dict(zip(columns_name, cname))
            code_tmp['qlist'] = columns_name
            bcode.update({qq: code_tmp})
            bdata = pd.concat([bdata, tmp], axis=1)
        elif (qtype in ['多选题', '排序题', '矩阵单选题']):
            bdata = pd.concat([bdata, data0], axis=1)
            bcode.update({qq: code[qq]})
    bdata = bdata.fillna(0)
    try:
        bdata = bdata.astype(np.int64, raise_on_error=False)
    except:
        pass
    return (bdata, bcode)
转化成哑变量
将数据中所有的单选题全部转化成哑变量，另外剔除掉开放题和填空题
返回一个很大的只有0和1的数据
def to_dummpy(data, code, qqlist=None, qtype_new='多选题', ignore_open=True):
    '转化成哑变量\n    将数据中所有的单选题全部转化成哑变量，另外剔除掉开放题和填空题\n    返回一个很大的只有0和1的数据\n    '
    if (qqlist is None):
        qqlist = sorted(code, key=(lambda x: int(re.findall('\\d+', x)[0])))
    bdata = pd.DataFrame()
    bcode = {}
    for qq in qqlist:
        qtype = code[qq]['qtype']
        data0 = data[code[qq]['qlist']]
        if (qtype == '单选题'):
            data0 = data0.iloc[:, 0]
            categorys = data0[data0.notnull()].unique()
            try:
                categorys = sorted(categorys)
            except:
                pass
            categorys = [t for t in categorys if (t in code[qq]['code'])]
            cname = [code[qq]['code'][k] for k in categorys]
            columns_name = ['{}_A{}'.format(qq, (i + 1)) for i in range(len(categorys))]
            tmp = pd.DataFrame(index=data0.index, columns=columns_name)
            for (i, c) in enumerate(categorys):
                tmp[columns_name[i]] = data0.map((lambda x: int((x == c))))
            code_tmp = {'content': code[qq]['content'], 'qtype': qtype_new}
            code_tmp['code'] = dict(zip(columns_name, cname))
            code_tmp['qlist'] = columns_name
            bcode.update({qq: code_tmp})
            bdata = pd.concat([bdata, tmp], axis=1)
        elif (qtype in ['多选题', '排序题', '矩阵单选题']):
            bdata = pd.concat([bdata, data0], axis=1)
            bcode.update({qq: code[qq]})
    bdata = bdata.fillna(0)
    try:
        bdata = bdata.astype(np.int64, raise_on_error=False)
    except:
        pass
    return (bdata, bcode)