Esempio n. 1
0
def rank(x):
    return utilities.rankSmart([float(y) for y in x])
Esempio n. 2
0
def rankprob(x):
    length = float(len(x))
    return [float(y) / length for y in utilities.rankSmart([float(y) for y in x])]
Esempio n. 3
0
import os, sys, glob
import utilities

inFilePath = sys.argv[1]
hasHeader = sys.argv[2] == "True"
columnIndex = int(sys.argv[3])
decreasing = sys.argv[4] == "True"
outFilePath = sys.argv[5]

data = utilities.readMatrixFromFile(inFilePath)

header = None
if hasHeader:
    header = data.pop(0)

values = [float(x[columnIndex]) for x in data]
ranks = utilities.rankSmart(values, decreasing=decreasing, ties="average")

outData = []
for i in range(len(data)):
    outData.append(data[i] + [str(ranks[i])])

if header != None:
    outData.insert(0, header)

utilities.writeMatrixToFile(outData, outFilePath)