I have a np.array with 800 values. Each value is either 0 or 1.
If the value is 0, I want to replace it with mu_0, which is a 1x2 array; else, I want to replace it with mu_1, which is also a 1x2 array.
I tried using np.where(y == 0, mu_0, mu_1), but python would only broadcast the value of mu to match y, not the other way around. In particular, the error I get is
ValueError: operands could not be broadcast together with shapes (800,) (2,) (2,)
I tried expanding y into (800, 2), by padding y_pad = np.c_[y, np.zeros(800)], but I am unsure how to condition on the first value of each row.
If I use np.where(y_pad[:, 0] == 0, ...), the array gets sliced back into (800,) again.