I am trying a very basic example in Python scipy module for transpose()
method but it\'s not giving expected result. I am using Ipython with pylab mode.
Transpose is a noop for one-dimensional arrays.
Add new axis and transpose:
>>> a[None].T
array([[1],
[2],
[3]])
>>> np.newaxis is None
True
Or reshape:
>>> a.reshape(a.shape+(1,))
array([[1],
[2],
[3]])
Or as @Sven Marnach suggested in comments, add new axis at the end:
>>> a[:,None]
array([[1],
[2],
[3]])