NumPy ndarray.__irshift__() | Shift NumPy Array Elements to Right Last Updated : 05 Feb, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The ndarray.__irshift__() method returns a new array where each element is right-shifted by the value that is passed as a parameter. Example Python3 import numpy as np gfg = np.array([1, 2, 3, 4, 5]) # applying ndarray.__irshift__() method print(gfg.__irshift__(2)) Output[0 0 0 1 1] SyntaxSyntax: ndarray.__irshift__($self, value, /) Parameter self: The numpy array.value: The number of positions to shiftReturn: New array where element is right shifted How to Shift Elements of the NumPy Array to the RightTo shift the elements of the NumPy array to the right we use ndarray.__irshift__() method of the NumPy library in Python. Let us understand it better with an example: Example: Python3 # import the important module in python import numpy as np # make an array with numpy gfg = np.array([[1, 2, 3, 4, 5], [6, 5, 4, 3, 2]]) # applying ndarray.__irshift__() method print(gfg.__irshift__(1)) Output[[0 1 1 2 2] [3 2 2 1 1]] Comment More infoAdvertise with us Next Article Python | Numpy numpy.ndarray.__lshift__() J jitender_1998 Follow Improve Article Tags : Python Python-numpy Python numpy-ndarray Practice Tags : python Similar Reads NumPy ndarray.__ilshift__() | Shift NumPy Array Elements to Left The ndarray.__ilshift__() method is an in-place left-shift operation. It shifts elements in the array to the left of the number of positions specified. Example Python3 import numpy as np gfg = np.array([1, 2, 3, 4, 5]) # applying ndarray.__ilshift__() method print(gfg.__ilshift__(2)) Output[ 4 8 12 1 min read Python | Numpy numpy.ndarray.__lshift__() With the help of Numpy numpy.ndarray.__lshift__() method, we can get the elements that is left shifted by the value that is provided as a parameter in numpy.ndarray.__lshift__() method. Syntax: ndarray.__lshift__($self, value, /) Return: self<<value Example #1 : In this example we can see that 1 min read NumPy Array Sorting | How to sort NumPy Array Sorting an array is a very important step in data analysis as it helps in ordering data, and makes it easier to search and clean. In this tutorial, we will learn how to sort an array in NumPy. You can sort an array in NumPy: Using np.sort() functionin-line sortsorting along different axesUsing np.ar 4 min read NumPy ndarray.transpose() Method | Find Transpose of the NumPy Array The ndarray.transpose() function returns a view of the array with axes transposed. For a 1-D array, this has no effect, as a transposed vector is simply the same vector.For a 2-D array, this is a standard matrix transpose.For an n-D array, if axes are given, their order indicates how the axes are pe 2 min read Python | Numpy numpy.ndarray.__rshift__() With the help of numpy.ndarray.__rshift__() method, we can get the elements that is right shifted by the value that is provided as a parameter in numpy.ndarray.__rshift__() method. Syntax: ndarray.__rshift__($self, value, /) Return: self>>value Example #1 : In this example we can see that ever 1 min read Python | Numpy numpy.ndarray.__invert__() With the help of Numpy numpy.ndarray.__invert__(), one can invert the elements of an array. We don't have to provide any type of parameter but remember that this method only works for integer values. Syntax: ndarray.__invert__($self, /) Return: ~self Example #1 : In this example we can see that ever 1 min read Like