numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
moveaxis(a, source, destination)

Other axes remain in their original order.

versionadded

Parameters

a : np.ndarray

The array whose axes should be reordered.

source : int or sequence of int

Original positions of the axes to move. These must be unique.

destination : int or sequence of int

Destination positions for each of the original axes. These must also be unique.

Returns

result : np.ndarray

Array with moved axes. This array is a view of the input array.

Move axes of an array to new positions.

See Also

swapaxes

Interchange two axes of an array.

transpose

Permute the dimensions of an array.

Examples

>>> x = np.zeros((3, 4, 5))
... np.moveaxis(x, 0, -1).shape (4, 5, 3)
>>> np.moveaxis(x, -1, 0).shape
(5, 3, 4)

These all achieve the same result:

>>> np.transpose(x).shape
(5, 4, 3)
>>> np.swapaxes(x, 0, -1).shape
(5, 4, 3)
>>> np.moveaxis(x, [0, 1], [-1, -2]).shape
(5, 4, 3)
>>> np.moveaxis(x, [0, 1, 2], [-1, -2, -3]).shape
(5, 4, 3)
See :

Back References

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

dask.array.numpy_compat.moveaxis numpy.transpose

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/core/numeric.py#1404
type: <class 'function'>
Commit: