Python NumPy roll() is an inbuilt NumPy function that is used for rolling array elements along a specified axis i.e., elements of an input array is being shifted. If the item is being rolled first to last-position, it is rolled back to the first position.

Python NumPy roll()

NumPy roll() function is defined under  NumPy, which can be imported as import NumPy as np, and we can create multidimensional arrays and derive other mathematical statistics with the help of NumPy, which is a library in Python.

Syntax

numpy.roll(array, shift, axis=None)

#python #numpy

Python NumPy roll() Function Example
12.00 GEEK