won’t that sort on the net like it is a reason code and my table with have net some where random?
I think I need to sort the pareto of the reasons for scrap.
Then after I have that sorted list, then I would insert the net and meta data like which machine.
I think after I have this this pareto with the net data, I can then do a percentage from column 1 (second thing in my rows should be a number, and divide the 4th thing, column 4? net number
to display as the new column 8? and column 7 would be the
errr
omg I have confused myself so bad, that I think I put the net title header into the list when I only need the number there, because the net header title is the actual table header
my table headers should be these guys
Reason | Scrap Qty | Net | Total Defects | Percentage of Defects
so
for i in range(len(pareto)):
for j in range(len(testThis)):
pareto[i].insert(len(pareto),testThis[j][1])
I defined suffixHeaders at the headers from the query for net and defects
I defined reasonHeaders and suffixHeaders.
reasonHeaders=[‘thisReason’,…‘nReason’]
suffixHeaders=[‘thisNet’,‘thisDefects’]
for row in dataIn:
data=[row[colName] for colName in reasonHeaders]
pareto = [[x, y] for y, x in sorted(zip(data, reasonHeaders),reverse=True)]
print pareto
for row in dataIn:
data2=[row[colName] for colName in suffixHeaders]
testThis =[[x,y] for y, x in zip(data2,suffixHeaders)]
print testThis
print len(pareto)
for i in range(len(pareto)):
for j in range(len(testThis)):
pareto[i].insert(len(pareto),testThis[j][1])
print '-----'
print pareto
It works, but it is not optimal
and I need to insert math too
tried this to add the math
for i in range(len(pareto)):
pareto[i].insert(len(pareto),(pareto[i][1]/pareto[i][3]))
but first it rounded to a whole number, and I need to check how to handle if they are zeroes
the query addresses nulls with sum(isnull(value,0)) as name