iAMR77
0
Q:

how to convert string labels to numpy array

print (pd.factorize(L)[0])
[0 1 2 1 0]
0
L = ['ABC', 'DEF', 'GHI', 'DEF', 'ABC']

print (np.unique(L, return_inverse=True)[1])
[0 1 2 1 0]
0

New to Communities?

Join the community