(self, names, sortkey, reverse=0)
return sortmap
Create a sort mapping for given list
Create a sort mapping for given list
Create a sort mapping for given list
def createSortMap(self, names, sortkey, reverse=0):
        """Create a sort mapping for given list"""

        recdata = []
        for rec in names:
            recdata.append(self.getRecordAttributeAtColumn(recName=rec, columnName=sortkey))
        #try create list of floats if col has numbers only
        try:
            recdata = self.toFloats(recdata)
        except:
            pass
        smap = zip(names, recdata)
        #sort the mapping by the second key
        smap = sorted(smap, key=operator.itemgetter(1), reverse=reverse)
        #now sort the main reclist by the mapping order
        sortmap = map(operator.itemgetter(0), smap)
        return sortmap
def createSortMap ( self , names , sortkey , reverse = 0 ) : recdata = [ ] for rec in names : recdata . append ( self . getRecordAttributeAtColumn ( recName = rec , columnName = sortkey ) ) #try create list of floats if col has numbers only try : recdata = self . toFloats ( recdata ) except : pass smap = zip ( names , recdata ) #sort the mapping by the second key smap = sorted ( smap , key = operator . itemgetter ( 1 ) , reverse = reverse ) #now sort the main reclist by the mapping order sortmap = map ( operator . itemgetter ( 0 ) , smap ) return sortmap