I have a numpy array data set with shape (100,10). Each row is a one-hot encoding. I want to transfer it into a nd-array with shape (100,) such that I transferred each vecto
Simply use np.argmax(x, axis=1)
np.argmax(x, axis=1)
Example:
import numpy as np array = np.array([[0, 1, 0, 0], [0, 0, 0, 1]]) print(np.argmax(array, axis=1)) > [1 3]