I'm fairly new to numpy arrays, so any help will be much appreciated.
I want to get a single slice of an n x m
array along the second axis, with the result being an n x 1
array, e.g.
a = np.array([[1, 2, 3],
[4, 5, 6]])
Then I want:
some_function(a, 0) = array([[1], [4]]) # to get slice of a, along index 0
I've tried a[:, 0]
which gives array([1, 4])
.
And:
np.transpose(a[:, 0])
also gives:
array([1, 4])
Which confuses me.
I'm sure this is really simple but can't find the correct some_function
!