numpy.sign() in Python Last Updated : 03 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report numpy.sign(array [, out]) function is used to indicate the sign of a number element-wise. For integer inputs, if array value is greater than 0 it returns 1, if array value is less than 0 it returns -1, and if array value 0 it returns 0. Syntax: numpy.sign() Parameters : array : [array_like] Input values. out : [ndarray, optional] Output array placed with result. Return : [ndarray] Returns the sign of array. If an array is scalar then the sign of array will be scalar. Code 1 : Python3 # Python Program illustrating # numpy.sign() method # importing numpy import numpy as geek # input arrays array1 = [1, 0, -13] array2 = [-1, 0, 15] # print the input arrays print ("input array1 : ", array1) print ("input array2 : ", array2) # determine the sign of integer numbers in an array print ("\nCheck sign of array1 : ", geek.sign(array1)) print ("\nCheck sign of array2 : ", geek.sign(array2)) Output : array1 : [1, 0, -13] array2 : [-1, 0, 15] Check sign of array1 : [ 1 0 -1] Check sign of array2 : [-1 0 1] Code 2 : Python3 # Python Program illustrating # numpy.sign() method # importing numpy import numpy as geek # determine the sign of complex number print ("\n Check sign of complex input1 : ", geek.sign(7-3j)) print ("\n Check sign of complex input2 : ", geek.sign(-7 + 3j)) Output : Check sign of complex input1 : (1+0j) Check sign of complex input2 : (-1+0j) Comment More infoAdvertise with us Next Article numpy.signbit() in Python S sanjoy_62 Follow Improve Article Tags : Python Python-numpy Practice Tags : python Similar Reads numpy.signbit() in Python numpy.signbit(array, out = None, where = True, casting = âsame_kindâ, order = âKâ, dtype = None) : This mathematical function helps user to element - wise check whether the signbit is set or not. Parameters : array : [array_like]Input array or object whose elements, we need to check. out : [ndarray, 2 min read numpy.sqrt() in Python numpy.sqrt() in Python is a function from the NumPy library used to compute the square root of each element in an array or a single number. It returns a new array of the same shape with the square roots of the input values. The function handles both positive and negative numbers, returning NaN for n 2 min read numpy.fabs() in Python numpy.fabs() function is used to compute the absolute values element-wise. This function returns the absolute values (positive magnitude) of the data in arr. It always return absolute values in floats. Syntax : numpy.fabs(arr, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, u 2 min read numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax :Â numpy.isnan(array [, out]) Parameters :Â array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed wit 2 min read numpy.invert() in Python numpy.invert() is a bitwise function in NumPy used to invert each bit of an integer array. It performs a bitwise NOT operation, flipping 0s to 1s and 1s to 0s in the binary representation of integers. Example:Pythonimport numpy as np a = np.array([1, 2, 3]) res = np.invert(a) print(res)Output[-2 -3 2 min read Number System in Python The arithmetic value that is used for representing the quantity and used in making calculations is defined as NUMBERS. The writing system for denoting numbers logically using digits or symbols is defined as a Number system. Number System is a system that defines numbers in different ways to represen 6 min read Like