(classList)
return sortedClassCount[0][0]
类别数多的类别
    :param classList: 类别
    :return: 返回类别数多的类别
类别数多的类别
    :param classList: 类别
    :return: 返回类别数多的类别
类别数多的类别 : param classList : 类别 : return : 返回类别数多的类别
def majorityCnt(classList):
    '''
    类别数多的类别
    :param classList: 类别
    :return: 返回类别数多的类别
    '''
    classCount={}
    for vote in classList:
        if vote not in classCount.keys(): classCount[vote] = 0
        classCount[vote] += 1
    sortedClassCount = sorted(classCount.iteritems(), key=operator.itemgetter(1), reverse=True)
    return sortedClassCount[0][0]
def majorityCnt ( classList ) : classCount = { } for vote in classList : if vote not in classCount . keys ( ) : classCount [ vote ] = 0 classCount [ vote ] += 1 sortedClassCount = sorted ( classCount . iteritems ( ) , key = operator . itemgetter ( 1 ) , reverse = True ) return sortedClassCount [ 0 ] [ 0 ]