Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.transpose

numpy.transpose(a,axes=None)[source]

Permute the dimensions of an array.

Parameters:

a : array_like

Input array.

axes : list of ints, optional

By default, reverse the dimensions, otherwise permute the axesaccording to the values given.

Returns:

p : ndarray

a with its axes permuted. A view is returned wheneverpossible.

Notes

Usetranspose(a, argsort(axes)) to invert the transposition of tensorswhen using theaxes keyword argument.

Transposing a 1-D array returns an unchanged view of the original array.

Examples

>>>x=np.arange(4).reshape((2,2))>>>xarray([[0, 1],       [2, 3]])
>>>np.transpose(x)array([[0, 2],       [1, 3]])
>>>x=np.ones((1,2,3))>>>np.transpose(x,(1,0,2)).shape(2, 1, 3)

Previous topic

numpy.swapaxes

Next topic

numpy.atleast_1d

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp