I have a NumPy string array in the shape of (112, 7). First few elements are just letters and the rest is numbers like follows
List[0] = array(['ID32', 'TRED', 'PLUS', '434','0.34', '11.9', '4.8'], dtype='<U14')
List[1] = array(['ID32', 'TRED', 'PLUS', '994','0.84', '44.3', '1.11'], dtype='<U14')
List[2] = array(['ID32', 'PROP', 'MINUS', '234','0.56', '44.3', '1.11'], dtype='<U14')
....
What I would like to achieve is the IF statement check the first three elements and if they are identical calculate the ratio of fourth and 5th element and remove the smaller one from the list
For instance List[0] and List[1] have same first three elements so checking the ratios (434/0.34 = 1276.5, 994/0.84 = 1183), so List[1] is smaller and should be removed from the list.
Here is my failed attempt
for i, val in enumerate(List):
if val[i][0] == val[i][1]
print(val[3].astype(np.float)/val[4].astype(np.float))
I appreciate any help.
pandasit can be easily done.