Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I know this is more a Python question. Here is my answer :

def pos_rat(x,y,sw) :
    if y>0:
        return x/y
    else :
        if sw == 1:
            return "-"
        elif sw == 2 :
            return -100000
def ratio_for_pivot(mat, var_ent, sw):
    a=[pos_rat(mat[i][mat.ncols()-1],mat[i][var_ent],sw) for i in range(mat.nrows()-1)]
    return a

I know this is more a Python question. Here is my answer :answer:

def pos_rat(x,y,sw) :
pos_rat(x, y, sw):
    if y>0:
y > 0:
        return x/y
    else :
else:
        if sw == 1:
            return "-"
        elif sw == 2 :
2:
            return -100000
 def ratio_for_pivot(mat, var_ent, sw):
    a=[pos_rat(mat[i][mat.ncols()-1],mat[i][var_ent],sw) a = [pos_rat(mat[i][mat.ncols() - 1], mat[i][var_ent], sw)
         for i in range(mat.nrows()-1)]
range(mat.nrows() - 1)]
    return a