[Numpy-discussion] speeding up getting a subset of a data array

Brennan Williams brennan.williams@visualreservoir....
Mon Aug 10 19:52:54 CDT 2009


No doubt asked many times before so apologies....

I'm pulling a subset array out of a data array where I have a list of 
the indices I want (could be an array rather than a list actually - I 
have it in both).

Potentially the number of points and the number of times I do this can 
get very large so any saving in time is good.

So, paraphrasing what I've currently got.... say I have...

for index,pos in enumerate(subsetpointerlist):

How do I speed this up in numpy, i.e. by removing the for loop?

Do I set up some sort of a subsetpointerarray as a mask and then somehow 
apply that to dataarray to get the values into subsetarray?



More information about the NumPy-Discussion mailing list