Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.matrix.transpose

matrix.transpose(*axes)

Returns a view of the array with axes transposed.

For a 1-D array, this has no effect. (To change between column androw vectors, first cast the 1-D array into a matrix object.)For a 2-D array, this is the usual matrix transpose.For an n-D array, if axes are given, their order indicates how theaxes are permuted (see Examples). If axes are not provided anda.shape=(i[0],i[1],...i[n-2],i[n-1]), thena.transpose().shape=(i[n-1],i[n-2],...i[1],i[0]).

Parameters:
axes:None, tuple of ints, orn ints
  • None or no argument: reverses the order of the axes.
  • tuple of ints:i in thej-th place in the tuple meansa’si-th axis becomesa.transpose()’sj-th axis.
  • n ints: same as an n-tuple of the same ints (this form isintended simply as a “convenience” alternative to the tuple form)
Returns:
out:ndarray

View ofa, with axes suitably permuted.

See also

ndarray.T
Array property returning the array transposed.

Examples

>>>a=np.array([[1,2],[3,4]])>>>aarray([[1, 2],       [3, 4]])>>>a.transpose()array([[1, 3],       [2, 4]])>>>a.transpose((1,0))array([[1, 3],       [2, 4]])>>>a.transpose(1,0)array([[1, 3],       [2, 4]])

Previous topic

numpy.matrix.trace

Next topic

numpy.matrix.var

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp