Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.rollaxis

numpy.rollaxis(a,axis,start=0)[source]

Roll the specified axis backwards, until it lies in a given position.

This function continues to be supported for backward compatibility, but youshould prefermoveaxis. Themoveaxis function was added in NumPy1.11.

Parameters:
a:ndarray

Input array.

axis:int

The axis to roll backwards. The positions of the other axes do notchange relative to one another.

start:int, optional

The axis is rolled until it lies before this position. The default,0, results in a “complete” roll.

Returns:
res:ndarray

For NumPy >= 1.10.0 a view ofa is always returned. For earlierNumPy versions a view ofa is returned only if the order of theaxes is changed, otherwise the input array is returned.

See also

moveaxis
Move array axes to new positions.
roll
Roll the elements of an array by a number of positions along a given axis.

Examples

>>>a=np.ones((3,4,5,6))>>>np.rollaxis(a,3,1).shape(3, 6, 4, 5)>>>np.rollaxis(a,2).shape(5, 3, 4, 6)>>>np.rollaxis(a,1,4).shape(3, 5, 6, 4)

Previous topic

numpy.moveaxis

Next topic

numpy.swapaxes

Quick search

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

[8]ページ先頭

©2009-2025 Movatter.jp