I have the following array:
import numpy as np
a = np.array(['a', 'b', 'c','a','a','d','e'])
b = np.array(['a','b'])
actual data stored in the arrays are uuids, example:
123e4567-e89b-12d3-a456-426614174000
I would like to search b in a and get the indices:
array([0, 3, 4, 1])
this solution can work for me:
np.nonzero(b[:, None] == a)[1]
but the problem is I'm dealing with huge arrays (15M in the non-unique and 150k in the unique sub-array with str_ type), so for the given operation I would need 1.8TB of memory which I don't have.
any idea how can I solve this issue or workaround the memory restrictions with my own solution?
thanks.
array([0, 3, 4, 1])
or would a sorted orderarray([0, 1, 3, 4])
be okay?