numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
a.transpose(*axes)

For a 1-D array this has no effect, as a transposed vector is simply the same vector. To convert a 1-D array into a 2D column vector, an additional dimension must be added. :None:None:`np.atleast2d(a).T` achieves this, as does :None:None:`a[:, np.newaxis]`. For a 2-D array, this is a standard matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted (see Examples). If axes are not provided and a.shape = (i[0], i[1], ... i[n-2], i[n-1]) , then a.transpose().shape = (i[n-1], i[n-2], ... i[1], i[0]) .

Parameters

axes : None, tuple of ints, or `n` ints
  • None or no argument: reverses the order of the axes.

  • tuple of ints: :None:None:`i` in the :None:None:`j`-th place in the tuple means a's :None:None:`i`-th axis becomes :None:None:`a.transpose()`'s :None:None:`j`-th axis.

  • :None:None:`n` ints: same as an n-tuple of the same ints (this form is intended simply as a "convenience" alternative to the tuple form)

Returns

out : ndarray

View of a, with axes suitably permuted.

Returns a view of the array with axes transposed.

See Also

ndarray.T

Array property returning the array transposed.

ndarray.reshape

Give a new shape to an array without changing its data.

transpose

Equivalent function

Examples

This example is valid syntax, but we were not able to check execution
>>> a = np.array([[1, 2], [3, 4]])
... a array([[1, 2], [3, 4]])
This example is valid syntax, but we were not able to check execution
>>> a.transpose()
array([[1, 3],
       [2, 4]])
This example is valid syntax, but we were not able to check execution
>>> a.transpose((1, 0))
array([[1, 3],
       [2, 4]])
This example is valid syntax, but we were not able to check execution
>>> a.transpose(1, 0)
array([[1, 3],
       [2, 4]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.lib._iotools.LineSplitter.autostrip

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/ma/core.py#2577
type: <class 'function'>
Commit: