Skip to content

Tag: numpy

Is there a faster version of numpy.random.shuffle?

I’m using numpy.random.shuffle in order to compute a statistic on randomized columns of a 2D array. The Python code is as follows: The speed I get is something like this: 1 loops, best of 3: 391 ms per loop I tried to Cythonize this function but I wasn’t sure how to replace the call to np.random.s…

Extending numpy.digitize to multi-dimensional data

I have a set of large arrays (about 6 million elements each) that I want to basically perform a np.digitize but over multiple axes. I am looking for some suggestions on both how to effectively do this but also on how to store the results. I need all the indices (or all the values, or a mask) of array A