Is it possible to convert a string vector into an indexed one using numpy ?
Suppose I have an array of strings like ['ABC', 'DEF', 'GHI', 'DEF', 'ABC'] etc. I want it to be changed to an array of integers like [0,1,2,1,0]. Is it possible using numpy? I know that Pandas has a Series class that can do this, courtesy of this answer. Is there something similar for numpy as well?
Edit : np.unique() returns unique value for all elements. What I'm trying to do is convert the labels in the Iris dataset to indices, such as 0 for Iris-setosa, 1 for Iris-versicolor and 2 for Iris-virginica respectively. Is there a way to do this using numpy?