I have a python list e with ~11,000 elements. I then have a list of indexes p of ~3,000 elements.
I want to filter e to keep only the elements at the indexes specified in p.
So far, I'm using simple list comprehension:
f = [x for i,x in enumerate(e) if i in p]
However, this implementation takes ~1s.
This might not be much, but as I have to do it for 10,000 lists, it becomes over 2 hours. I then have to repeat this again for 200 batches of 10,000 lists, so it's really too slow.
Any idea of how I can achieve the same result in a quicker manner?