How can I turn each element in a numpy array into its index in another array?
Take the following example. Let a = np.array(["a", "c", "b", "c", "a", "a"])
and b = np.array(["b", "c", "a"])
. How can I turn each element in a
into its index in b
to obtain c = np.array([2, 1, 0, 1, 2, 2])
?