I have a large dataframe of experimental results, which I need to triage to remove 'dominated' subjects across multiple criteria. The following 'toy' dataframe reflects the overall structure but not necessarily the dimensions of the 'experimental' dataframe.
df = pd.DataFrame({'Subject': ['Alpha', 'Bravo', 'Charlie'],
'A': [6, 7, 8],
'B': [11, 7, 12],
'C': [13, 6, 6],
'D': [5, 9, 4],
'E': [11, 9, 5],
'F': [9, 10, 3],
'G': [2, 6, 5],
'H': [8, 12, 11]})
Subject A B C D E F G H
0 Alpha 6 11 13 5 11 9 2 8
1 Bravo 7 7 6 9 9 10 6 12
2 Charlie 8 12 6 4 5 3 5 11
How do I generate the following results using a 'less than' pairwise comparison.
[0, 1]: w=5, l=3, d=0
[0, 2]: w=4, l=4, d=0
[1, 2]: w=2, l=5, d=1
and combine them with the following pseudocode to create the subset of dominated subjects ['Bravo'] and remove it from the original dataframe?
tx = 3
i = 0
subject[0]='Alpha'
subject[1]='Bravo'
if w > l and l < tx
then y[i] = subject[0]
z[i] = subject[1]
elseif w < l and w < tx
then y[i] = subject[1]
z[i] = subject[0]
i += 1
Please advise?