I have the following table
a1b1 | a1Eb1 | a1b2 | a1Eb2 | a2b1 | a2Eb1 | a2b2 | a2Eb2 | a3b1 | a3Eb1 | a3b2 | a3Eb2 |
---|---|---|---|---|---|---|---|---|---|---|---|
2 | 20 | 8 | 54 | 3 | 56 | 3 | 67 | 2 | 78 | 7 | 75 |
8 | 30 | 6 | 67 | 6 | 35 | 4 | 56 | 3 | 85 | 6 | 74 |
5 | 54 | 4 | 64 | 7 | 23 | 6 | 48 | 4 | 67 | 4 | 82 |
6 | 65 | 7 | 53 | 8 | 27 | 7 | 35 | 5 | 25 | 3 | 64 |
4 | 34 | 2 | 52 | 4 | 28 | 8 | 27 | 6 | 94 | 2 | 29 |
i want to compare the following data:
a1b1 vs a1b2;
then generate arrays containing
a1b1 | a1b2 | minor a1b1 |
---|---|---|
2 | 8 | 20 |
a1b2 | a1b1 | minor a1b2 |
---|---|---|
6 | 8 | 30 |
and so for each row of the table
and for each of the following comparisons
- a2b1 vs a2b2;
- a3b1 vs a3b2;
I have tried to do it with pandas in python
import pandas as pd
import numpy as np
df = pd.DataFrame ({'a1b1':[2,8,5,6,4],
'a1Eb1':[20,30,54,65,34],
'a1b2':[8,6,4,7,2],
'a1Eb2':[54,67,64,53,52],
'a2b1':[3,6,7,8,4],
'a2Eb1':[56,35,23,27,28],
'a2b2':[3,4,6,7,8],
'a2Eb2':[67,56,48,35,27],
'a3b1':[2,3,4,5,6],
'a3Eb1':[78,85,67,25,94],
'a3b2':[7,6,4,3,2],
'a3Eb3':[75,74,82,64,29],
})
but i don't know how to go on.
Output expected
To the first line a1b1<a1b2 then print the following
df1=pd.DataFrame{'a1b1':[2],
'a1b2':[8],
'a1Eb1':[20]}
This can be, a DataFrame, a list or any data structure