numpy.rollaxis() function | Python Last Updated : 22 Apr, 2020 Comments Improve Suggest changes Like Article Like Report numpy.rollaxis() function roll the specified axis backwards, until it lies in a given position. Syntax : numpy.rollaxis(arr, axis, start=0) Parameters : arr : [ndarray] Input array. axis : [int] The axis to roll backwards. The positions of the other axes do not change 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. Return : [ndarray] In earlier NumPy versions, arr is returned only if the order of the axes is changed, otherwise the input array is returned. For NumPy >= 1.10.0, a view of arr is always returned. Code #1 : Python3 # Python program explaining # numpy.rollaxis() function # importing numpy as geek import numpy as geek arr = geek.ones((1, 2, 3, 4)) gfg = geek.rollaxis(arr, 3, 1).shape print (gfg) Output : (1, 4, 2, 3) Code #2 : Python3 # Python program explaining # numpy.rollaxis() function # importing numpy as geek import numpy as geek arr = geek.ones((1, 2, 3, 4)) gfg = geek.rollaxis(arr, 2).shape print (gfg) Output : (3, 1, 2, 4) Comment More infoAdvertise with us Next Article numpy.rollaxis() function | Python sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-arrayManipulation python Practice Tags : Machine Learningpython Similar Reads numpy.swapaxes() function - Python numpy.swapaxes() function allow us to interchange two axes of a multi-dimensional NumPy array. It focuses on swapping only two specified axes while leaving the rest unchanged. It is used to rearrange the structure of an array without altering its actual data. The syntax of numpy.swapaxes() is:numpy. 2 min read numpy.roll() in Python The numpy.roll() function rolls array elements along the specified axis. Basically what happens is that elements of the input array are being shifted. If an element is being rolled first to the last position, it is rolled back to the first position. Syntax : numpy.roll(array, shift, axis = None) Par 2 min read Numpy recarray.swapaxes() function | Python In numpy, arrays may have a data-types containing fields, analogous to columns in a spreadsheet. An example is [(a, int), (b, float)], where each entry in the array is a pair of (int, float). Normally, these attributes are accessed using dictionary lookups such as arr['a'] and arr['b']. Record array 3 min read Numpy recarray.cumsum() function | Python In numpy, arrays may have a data-types containing fields, analogous to columns in a spreadsheet. An example is [(a, int), (b, float)], where each entry in the array is a pair of (int, float). Normally, these attributes are accessed using dictionary lookups such as arr['a'] and arr['b']. Record array 2 min read Numpy recarray.cumprod() function | Python In numpy, arrays may have a data-types containing fields, analogous to columns in a spreadsheet. An example is [(a, int), (b, float)], where each entry in the array is a pair of (int, float). Normally, these attributes are accessed using dictionary lookups such as arr['a'] and arr['b']. Record array 2 min read numpy.moveaxis() function | Python numpy.moveaxis() function allows you to rearrange axes of an array. It is used when you need to shift dimensions of an array to different positions without altering the actual data. The syntax for the numpy.moveaxis() function is as follows:numpy.moveaxis(array, source, destination)Parameters:array: 2 min read numpy.right_shift() in Python numpy.right_shift() function is used to Shift the bits of an integer to the right. Because the internal representation of numbers is in binary format, this operation is equivalent to dividing arr1 by 2**arr2. For example, if the number is 20 and we want to 2-bit right shift then after right shift 2- 2 min read numpy.cumsum() in Python numpy.cumsum() function is used to compute the cumulative sum of elements in an array. Cumulative sum refers to a sequence where each element is the sum of all previous elements plus itself. For example, given an array [1, 2, 3, 4, 5], the cumulative sum would be [1, 3, 6, 10, 15]. Let's implement t 3 min read numpy.left_shift() in Python numpy.left_shift() function is used to Shift the bits of an integer to the left. The bits are shifted to the left by appending arr2 0s(zeroes) at the right of arr1. Since the internal representation of numbers is in binary format, this operation is equivalent to multiplying arr1 by 2**arr2. For exam 2 min read numpy.apply_along_axis() in Python The numpy.apply_along_axis() function helps us to apply a required function to 1D slices of the given array. 1d_func(ar, *args) : works on 1-D arrays, where ar is 1D slice of arr along axis. Syntax : numpy.apply_along_axis(1d_func, axis, array, *args, **kwargs) Parameters : 1d_func : the required fu 3 min read Like