def dataText_to_code(df, sep, qqlist=None):
    '编码文本数据\n\n    '
    if (sep in [';', '┋']):
        qtype = '多选题'
    elif (sep in ['-->', '→']):
        qtype = '排序题'
    if (not qqlist):
        qqlist = df.columns
    code = {}
    for qq in qqlist:
        tmp = df[qq].map((lambda x: (x.split(sep) if isinstance(x, str) else [])))
        item_list = sorted(set(tmp.sum()))
        if (qtype == '多选题'):
            tmp = tmp.map((lambda x: [int((t in x)) for t in item_list]))
            code_tmp = {'code': {}, 'qtype': u'多选题', 'qlist': [], 'content': qq}
        elif (qtype == '排序题'):
            tmp = tmp.map((lambda x: [((x.index(t) + 1) if (t in x) else np.nan) for t in item_list]))
            code_tmp = {'code': {}, 'qtype': u'排序题', 'qlist': [], 'content': qq}
        for (i, t) in enumerate(item_list):
            column_name = '{}_A{:.0f}'.format(qq, (i + 1))
            df[column_name] = tmp.map((lambda x: x[i]))
            code_tmp['code'][column_name] = item_list[i]
            code_tmp['qlist'] = (code_tmp['qlist'] + [column_name])
        code[qq] = code_tmp
        df.drop(qq, axis=1, inplace=True)
    return (df, code)
编码文本数据
def dataText_to_code(df, sep, qqlist=None):
    '\n\n    '
    if (sep in [';', '┋']):
        qtype = '多选题'
    elif (sep in ['-->', '→']):
        qtype = '排序题'
    if (not qqlist):
        qqlist = df.columns
    code = {}
    for qq in qqlist:
        tmp = df[qq].map((lambda x: (x.split(sep) if isinstance(x, str) else [])))
        item_list = sorted(set(tmp.sum()))
        if (qtype == '多选题'):
            tmp = tmp.map((lambda x: [int((t in x)) for t in item_list]))
            code_tmp = {'code': {}, 'qtype': u'多选题', 'qlist': [], 'content': qq}
        elif (qtype == '排序题'):
            tmp = tmp.map((lambda x: [((x.index(t) + 1) if (t in x) else np.nan) for t in item_list]))
            code_tmp = {'code': {}, 'qtype': u'排序题', 'qlist': [], 'content': qq}
        for (i, t) in enumerate(item_list):
            column_name = '{}_A{:.0f}'.format(qq, (i + 1))
            df[column_name] = tmp.map((lambda x: x[i]))
            code_tmp['code'][column_name] = item_list[i]
            code_tmp['qlist'] = (code_tmp['qlist'] + [column_name])
        code[qq] = code_tmp
        df.drop(qq, axis=1, inplace=True)
    return (df, code)