numpy.fabs() in Python Last Updated : 28 Nov, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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, ufunc ‘fabs') Parameters : arr : [array_like] The array of numbers for which the absolute values are required. out : [ndarray, optional] A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. **kwargs : Allows to pass keyword variable length of argument to a function. It is used when we want to handle named argument in a function. where : [array_like, optional] True value means to calculate the universal functions(ufunc) at that position, False value means to leave the value in the output alone. Return : [ndarray or scalar] The absolute values of arr, the returned values are always floats. Code #1 : Working Python # Python program explaining # fabs() function import numpy as geek in_num = 10 print ("Input number : ", in_num) out_num = geek.fabs(in_num) print ("Absolute value of positive input number : ", out_num) Output : Input number : 10 Absolute value of positive input number : 10.0 Code #2 : Python # Python program explaining # fabs() function import numpy as geek in_num = -9.0 print ("Input number : ", in_num) out_num = geek.fabs(in_num) print ("Absolute value of negative input number : ", out_num) Output : Input number : -9.0 Absolute value of negative input number : 9.0 Code #3 : Python # Python program explaining # fabs() function import numpy as geek in_arr = [2, 0, -2, -5] print ("Input array : ", in_arr) out_arr = geek.fabs(in_arr) print ("Output absolute array : ", out_arr) Output : Input array : [2, 0, -2, -5] Output absolute array : [ 2. 0. 2. 5.] Comment More infoAdvertise with us Next Article numpy.asfortranarray() in Python J jana_sayantan Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads bin() in Python Python bin() function returns the binary string of a given integer. bin() function is used to convert integer to binary string. In this article, we will learn more about Python bin() function. Example In this example, we are using the bin() function to convert integer to binary string. Python3 x = b 2 min read numpy.finfo() function â Python numpy.finfo() function shows machine limits for floating point types. Syntax : numpy.finfo(dtype) Parameters : dtype : [float, dtype, or instance] Kind of floating point data-type about which to get information. Return : Machine parameters for floating point types. Code #1 : Python3 # Python program 1 min read numpy.asfortranarray() in Python numpy.asfortranarray() function is used when we want to convert input to a array which is laid out in Fortran order in memory. Input includes scalar, lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays. Syntax : numpy.asfortranarray(arr, dtype=None)Â Parameters :Â arr : [ar 2 min read Python | math.fabs() function In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.fabs() function returns the absolute value of the number. Syntax: math.fabs(x) Parameter: x: This is a numeric expression. Returns: the absolute value of the number. Time Comp 1 min read numpy.who function - Python numpy.who() function print the NumPy arrays in the given dictionary. Syntax : numpy.who(vardict = None) Parameters : vardict : [dict, optional] A dictionary possibly containing ndarrays. Return : Returns âNoneâ. If there is no dictionary passed in or vardict is None then returns NumPy arrays in the 1 min read numpy.loadtxt() in Python numpy.loadtxt() function is used to load data from a text file and return it as a NumPy array. It is ideal for reading large data sets that are stored in simple text formats, such as CSV files or space-separated files.Example: Basic Usage of numpy.loadtxt() for Reading a Simple Space-Separated FileT 4 min read Like