I am looking for a quicker way to filter out the list of tuples, using numpy and avoiding loops.
A = [(27157, 4),
(24814, 0),
(1047, 2),
(18265, 2),
(2857, 4),
(23854, 2),
(36881, 0)]
Now I have to filter it based on the second element, i.e. 4. If '4' is present form one list 'B', if not form list 'C'.
That is:
B = [(27157, 4),(2857, 4)]
C = [(24814, 0),(1047, 2),(18265, 2),(23854, 2),(36881, 0)]