Given 2 arrays: One for a master dataset, and the second as list of grouped indices that reference the master dataset. I\'m looking for the fastest to generate new arrays fr
You just have to reshape the index array:
>>> result = POINT_CLOUD[INDICES.T]
>>> np.allclose(result[0], LIST1)
True
>>> np.allclose(result[1], LIST2)
True
If you know the number of sub-arrays you can also unpack the list
>>> result.shape
(2, 1000000, 3)
>>> L1, L2 = result
>>> np.allclose(L1, LIST1)
True
>>> # etc
This works for larger index groups. For the second example in your question:
>>> INDICES = (np.random.rand(COUNT,4)*COUNT).astype(int)
>>> SPLIT = POINT_CLOUD[INDICES.T]
>>> SPLIT.shape
(4, 1000000, 3)
>>>