def sjzl(data, number=None):
    import pandas as pd
    # 第一
    bt = []
    for i in list(data):
        bt.append(len(list(set(data[i]))))

    xt = []
    for i in bt:
        if i >= 20:
            xt.append('I')
        else:
            xt.append('C')

    zs = data.shape[0]
    zszs = []
    for i in xt:
        zszs.append(zs)

    kz = list(data.isnull().sum())
    kzbl = []
    for i in kz:
        kzbl.append(str(i / zs) + '%')

    yz = []
    for i in kz:
        yz.append(zs - i)

    yzbl = []
    for i in yz:
        yzbl.append(str(i / zs) + '%')

    lists = [
        xt,
        bt,
        kz,
        kzbl,
        yz,
        yzbl,
        zszs
    ]

    df1 = pd.DataFrame(data=lists, index=['数据形态', '不同值个数', '空值个数', '空值比例', '有值个数', '有值比例', '数据总数'],
                       columns=[list(data)])

    # 第二
    listss = list(data.describe())
    listssa = []
    for i in listss:
        mean = data[i].describe()[1]
        std = data[i].describe()[2]
        min_ = data[i].describe()[3]
        max_ = data[i].describe()[-1]
        M_3 = data[i].describe()[1] - 3 * std
        M3 = data[i].describe()[1] + 3 * std

        j = [min_, max_, mean, std, M_3, M3]
        listssa.append(j)
    df2 = pd.DataFrame(data=listssa, index=listss, columns=['MIN', 'MAX', 'Mean', 'Std', 'M-3', 'M+3'])

    # 第三
    listsa = []
    list_b = []
    if number == None:
        number = 10
    else:
        number
    for i in list(data):
        if len(list(set(data[i]))) <= number:
            list_b.append(i)
    for b in list_b:

        listda = []
        sumx = []
        lista = []
        lists = list(set(data[b]))
        for i in list(set(data[b])):
            lista.append((data[b] == i).sum())
        for i in lista:
            sumx.append(str("%.0f" % ((i / sum(lista)) * 100) + '%'))
        a = 0
        for x in lists:
            listda.append(str(x) + '(' + sumx[a] + ')')
            a += 1

        listsa.append(listda)
        listsa.append(lista)
    x = []
    for b in list_b:
        x.append(b)
        x.append(' ')
    df3 = pd.DataFrame(data=listsa, index=x)

    writer = pd.ExcelWriter('数据质量.xlsx')
    df1.to_excel(writer, 'Sheet1')
    df2.to_excel(writer, 'Sheet2')
    df3.to_excel(writer, 'Sheet3')
    writer.save()

