Maybe this is a very simple task, but I have a numpy.ndarray with shape (1988,3).
preds = [[1 0 0]
[0 1 0]
[0 0 0]
...
[0 1 0]
[1 0 0]
[0 0 1]]
I want to create a 1D array with shape=(1988,) that will have values corresponding to the column of my 3D array that has a value of 1.
For example,
new_preds = [0 1 NaN ... 1 0 2]
How can I do this?
new_preds = np.argmax(preds, axis=1)