what is the one hot encoding for cancer data classification
Both ways would work equally, but the way you see in the github repo is more standard. 

The standard way of converting a integer label $y_i$ (from 0 to K-1) into a one-hot vector encoding is by creating a all-zero vector of length K, and set the element indexed by $y_i$ to be 1, i.e.

label_one_hot = np.zeros(k)
label_one_hot[label] = 1