Pick a certain axis from a numpy array
a[:,i] works again. If you need to, you can add dimensions with .reshape(100,1,15,27) or a nicer way, np.expand_dims(a, axis=1).
I have a numpy array of size (100, 2, 15, 27) (these are 100 images, with 2 channels of size 15x27). I want to separate the 2 channels in order to get 2 separate arrays of size (100, 1, 15, 27) (I do need that 1 there). How can I do that? I usually pick column using a[:,i], but this higher dimensionality confuses me. Thank you!