cf.List.roll¶
-
List.
roll
(*args, **kwargs)[source]¶ Roll the data along one or more axes.
Elements that roll beyond the last position are re-introduced at the first.
See also
- Parameters
- axis:
int
, ortuple
ofint
Axis or axes along which elements are shifted.
- Parameter example:
Roll the second axis:
axis=1
.- Parameter example:
Roll the last axis:
axis=-1
.- Parameter example:
Roll the first and last axes:
axis=(0, -1)
.
- shift:
int
, ortuple
ofint
The number of places by which elements are shifted. If a
tuple
, then axis must be a tuple of the same size, and each of the given axes is shifted by the corresponding number. If anint
while axis is atuple
ofint
, then the same value is used for all given axes.- inplace:
bool
, optional If True then do the operation in-place and return
None
.- i: deprecated at version 3.0.0
Use the inplace parameter instead.
- axis:
- Returns
Examples
>>> print(f.array) [ 0 1 2 3 4 5 6 7 8 9 10 11] >>> print(f.roll(0, 2).array) [10 11 0 1 2 3 4 5 6 7 8 9] >>> print(f.roll(0, -2).array) [ 2 3 4 5 6 7 8 9 10 11 0 1]