NumPy ndarray.__abs__() | Find Absolute Value of Elements in NumPy Array Last Updated : 05 Feb, 2024 Comments Improve Suggest changes Like Article Like Report The ndarray.__abs__() method returns the absolute value of every element in the NumPy array. It is automatically invoked when we use Python's built-in method abs() on a NumPy array. Example Python3 import numpy as np gfg = np.array([1.45, 2.32, 3.98, 4.41, 5.55, 6.12]) print(gfg.__abs__()) Output[ 1 2 3 4 5 6] SyntaxSyntax: ndarray.__abs__() Return: Returns an array with absolute values. How to find Absolute Values of the NumPy ArrayTo find absolute values of the elements of NumPy array we use ndarray.__abs__() method of the NumPy library in Python. Let's 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.22, 2.25, -3.21, 4.45, 5.56, 6], [-6.65, 5.55, 4.32, 3.33, 2.12, -1.05]]) # applying ndarray.__abs__() method print(gfg.__abs__()) Output[[ 1 2 3 4 5 6 ] [ 6 5 4 3 2 1]] Comment More infoAdvertise with us Next Article How to compute numerical negative value for all elements in a given NumPy array? J jitender_1998 Follow Improve Article Tags : Python Python-numpy Python numpy-ndarray Practice Tags : python Similar Reads NumPy ndarray.size() Method | Get Number of Elements in NumPy Array The ndarray.size() method returns the number of elements in the NumPy array. It works the same as np.prod(a.shape), i.e., the product of the dimensions of the array. Example Python3 import numpy as np arr = np.zeros((3, 4, 2), dtype = np.complex128) gfg = arr.size print (gfg) Output : 24Syntax Synta 1 min read NumPy ndarray.size() Method | Get Number of Elements in NumPy Array The ndarray.size() method returns the number of elements in the NumPy array. It works the same as np.prod(a.shape), i.e., the product of the dimensions of the array. Example Python3 import numpy as np arr = np.zeros((3, 4, 2), dtype = np.complex128) gfg = arr.size print (gfg) Output : 24Syntax Synta 1 min read NumPy ndarray.size() Method | Get Number of Elements in NumPy Array The ndarray.size() method returns the number of elements in the NumPy array. It works the same as np.prod(a.shape), i.e., the product of the dimensions of the array. Example Python3 import numpy as np arr = np.zeros((3, 4, 2), dtype = np.complex128) gfg = arr.size print (gfg) Output : 24Syntax Synta 1 min read How to compute numerical negative value for all elements in a given NumPy array? In this article, we will see how to compute the negative value for all elements in a given NumPy array. So, The negative value is actually the number which when added to any number becomes 0. Example: If we take a number as 4 then -4 is its negative number because when we add -4 to 4 we get sum as 2 min read How to compute numerical negative value for all elements in a given NumPy array? In this article, we will see how to compute the negative value for all elements in a given NumPy array. So, The negative value is actually the number which when added to any number becomes 0. Example: If we take a number as 4 then -4 is its negative number because when we add -4 to 4 we get sum as 2 min read Find indices of elements equal to zero in a NumPy array Sometimes we need to find out the indices of all null elements in the array. Numpy provides many functions to compute indices of all null elements. Method 1: Finding indices of null elements using numpy.where() This function returns the indices of elements in an input array where the given conditio 3 min read Like