I have a numpy array like this:
a = [['I05', 'U13', 4],
['I12', 'U13', 5],
['I22', 'U13', 3],
['I03', 'U15', 5],
['I14', 'U23', 5],
['I12', 'U23', 2],
['I15', 'U43', 5]]
Here we have two entries for U13 and three entries for U23. So I need to keep those arrays and remove the rest.
I want a result like this after removing:
a = [['I05', 'U13', 4],
['I12', 'U13', 5],
['I22', 'U13', 3],
['I14', 'U23', 5],
['I12', 'U23', 2]]
How to do this efficiently?
The arrays are already sorted on the second column (the 'UXX' values).