I have two lists in python with elements. I want to perform some checks on these two lists. My lists are as follows:
list_A = [["'EASY'", "'LEVEL_C'", "'4'", '0.714', '\n'], ["'EASY'", "'LEVEL_D'", "'5'", '0.778', '\n'], ["'EASY'", "'LEVEL_D'", "'5'", '0.226', '\n'], ["'EASY'", "'LEVEL_D'", "'5'", '0.222', '\n'], ...]
list_B = [["'EASY'", "'LEVEL_B'", "'2'", '1.000', '\n'], ["'EASY'", "'LEVEL_C'", "'3'", '1.000', '\n'], ["'EASY'", "'LEVEL_D'", "'4'", '1.000', '\n'], ["'EASY'", "'LEVEL_D'", "'4'", '0.290', '\n'], ...]
For the variable "EASY" and for the level of the variable that takes values (LEVEL_A - LEVEL_F), there is a third variable corresponding to the estimate (1-6) and the confidence variable (0-1). What I want to do is to compare the two lists for the variable easy and level and find in all cases which of the two lists (list_A and list_B) has the highest score and with certainty. How can i do this?
The way I build my rules, first I got the lines received from the executable file and filtered them in the lists. A prime example for my listings is:
Rule: ('EASY', 'LEVEL_E') ==> ('4') , 0.182
'EASY' 'LEVEL_E' '4' 0.182
["'EASY'", "'LEVEL_E'", , "'4'", '0.182', '\n']
and the code I use to create the vector:
for row in my_lines:
print row
row = re.sub('[()]', "", row)
row = row.replace("Rule: ", "")
row = row.replace(",", "")
row = row.replace("==>", "")
print row
split = re.split(r' +', row)
print split
, , , Level:
list_A.sort(key=lambda x: x[1])
list_B.sort(key=lambda x: x[1])
EDIT: . . , , , , . ?