um quente codificando numpy
labels = (np.arange(num_labels) == labels[:,None]).astype(np.float32)
Cooperative Copperhead
labels = (np.arange(num_labels) == labels[:,None]).astype(np.float32)
one_hot_encode=pandas.get_dummies(array)
import numpy as np
a = np.array([1, 0, 3])
b = np.zeros((a.size, a.max()+1))
b[np.arange(a.size),a] = 1
print(b)