It's likely because there a built-in functions with the same name, abs. The same is true for np.amax, np.amin and np.round_.

The aliases for the NumPy functions abs, min, max and round are only defined in the top-level package.

So np.abs and np.absolute are completely identical. It doesn't matter which one you use.

There are several advantages to the short names: They are shorter and they are known to Python programmers because the names are identical to the built-in Python functions. So end-users have it easier (less to type, less to remember).

But there are reasons to have different names too: NumPy (or more generally 3rd party packages) sometimes need the Python functions abs, min, etc. So inside the package they define functions with a different name so you can still access the Python functions - and just in the top-level of the package you expose the "shortcuts". Note: Different names are not the only available option in that case: One could work around that with the Python module builtins to access the built-in functions if one shadowed a built-in name.

It might also be the case (but that's pure speculation on my part) that they originally only included the long-named functions absolute (and so on) and only added the short aliases later. Being a large and well-used library the NumPy developers don't remove or deprecate stuff lightly. So they may just keep the long names around because it could break old code/scripts if they would remove them.

Answer from MSeifert on Stack Overflow
Top answer
1 of 3
106

It's likely because there a built-in functions with the same name, abs. The same is true for np.amax, np.amin and np.round_.

The aliases for the NumPy functions abs, min, max and round are only defined in the top-level package.

So np.abs and np.absolute are completely identical. It doesn't matter which one you use.

There are several advantages to the short names: They are shorter and they are known to Python programmers because the names are identical to the built-in Python functions. So end-users have it easier (less to type, less to remember).

But there are reasons to have different names too: NumPy (or more generally 3rd party packages) sometimes need the Python functions abs, min, etc. So inside the package they define functions with a different name so you can still access the Python functions - and just in the top-level of the package you expose the "shortcuts". Note: Different names are not the only available option in that case: One could work around that with the Python module builtins to access the built-in functions if one shadowed a built-in name.

It might also be the case (but that's pure speculation on my part) that they originally only included the long-named functions absolute (and so on) and only added the short aliases later. Being a large and well-used library the NumPy developers don't remove or deprecate stuff lightly. So they may just keep the long names around because it could break old code/scripts if they would remove them.

2 of 3
23

There also is Python's built-in abs(), but really all those functions are doing the same thing. They're even exactly equally fast! (This is not the case for other functions, like max().)

Code to reproduce the plot:

import numpy as np
import perfplot


def np_absolute(x):
    return np.absolute(x)


def np_abs(x):
    return np.abs(x)


def builtin_abs(x):
    return abs(x)


b = perfplot.bench(
    setup=np.random.rand,
    kernels=[np_abs, np_absolute, builtin_abs],
    n_range=[2 ** k for k in range(25)],
    xlabel="len(data)",
)
b.save("out.png")
b.show()
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v2.4 Manual
An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\).
Discussions

abs vs np.abs
Ahead of Time compiler for numeric kernels. Contribute to serge-sans-paille/pythran development by creating an account on GitHub. More on github.com
🌐 github.com
3
September 23, 2014
Differences in abs()
The last two should be the same. For what values of x and y are you getting different answers? The first one really is different. If x=3 and y=5, the first one is abs(3)-abs(5) = 3 - 5 = -2 where as the second one is abs(3-5) = abs(-2) = +2 More on reddit.com
🌐 r/learnpython
8
1
October 6, 2022
Calculate mean absolute error of a numpy array and output it?
The mean absolute error between two vectors (numpy.ndarray) of measurements x and y would be abs(x - y).mean(). What you've got there looks a bit weird, and I suspect you meant to write ( p√∑(|𝑌̂𝑖−𝑌𝑖|)p ) / n where n would the number of samples. This is an average based on the p-norm. That's probably easiest to implement using the norm function, so your code would look something like this: numpy.linalg.norm(x - y, ord=p) / x.size You can play around with the axis= argument in order to take a norm along each row or column of a matrix. More on reddit.com
🌐 r/learnpython
1
1
April 1, 2021
How to write a function to find the median absolute deviation of a dataset?
Have you tried scipy.stats.median_absolute_deviation ? More on reddit.com
🌐 r/learnpython
3
1
March 1, 2021
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Calculate the absolute value element-wise (np.abs, np.fabs) | note.nkmk.me
January 14, 2024 - You can calculate the absolute value element-wise in a NumPy array (ndarray) using np.abs(), np.absolute(), or np.fabs(). Note that np.abs() is simply an alias for np.absolute(). Additionally, the bui ...
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v2.2 Manual
An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\).
🌐
Finxter
blog.finxter.com › home › learn python blog › python abs() function
Python abs() Function – Be on the Right Side of Change
November 29, 2020 - Python’s built-in function abs(x) calculates the absolute number of the argument x. Similarly, NumPy’s np.abs(x) function calculates the same absolute value.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v2.5.dev0 Manual
An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\).
🌐
Codecademy
codecademy.com › docs › python:numpy › math methods › .abs()
Python:NumPy | Math Methods | .abs() | Codecademy
June 12, 2025 - The NumPy’s .abs() function calculates the absolute value of a given number or each element in an array. A number’s absolute value is its non-negative value or its distance from zero.
🌐
CSDN
devpress.csdn.net › python › 62fd1a1f7e668234661915f7.html
Should I use np.absolute or np.abs?_python_Mangs-Python
Is there any reason i should preferentially use np.absolute over np.abs in my code, or should I simply go for the more "standard" np.abs? It's likely because there a built-in functions with the same name, abs. The same is true for np.amax, np.amin and np.round_. The aliases for the NumPy functions abs, min, max and round are only defined in the top-level package.
Find elsewhere
🌐
GitHub
github.com › serge-sans-paille › pythran › issues › 321
abs vs np.abs · Issue #321 · serge-sans-paille/pythran
September 23, 2014 - These 2 functions should have the same behavior but np.abs is the only one working on numpy array.
Author   pbrunet
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v2.1 Manual
An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\).
🌐
Medium
mr-amit.medium.com › what-is-numpy-absolute-and-when-to-use-it-0a2c48189200
What is numpy.absolute() and When to Use It? | by It's Amit | Medium
March 6, 2025 - Okay, jokes aside, here’s the deal: numpy.absolute() is your go-to method for finding the absolute value of numbers in an array. Whether the numbers are negative, positive, or even complex, this method transforms everything into its non-negative ...
🌐
Skytowner
skytowner.com › explore › numpy_abs_method
NumPy | abs method with Examples
NumPy's np.abs(~) method returns a NumPy array with the absolute value applied to each of its values.
🌐
Python Guides
pythonguides.com › python-numpy-absolute-value
NumPy's Np.abs() Function In Python
May 16, 2025 - NumPy’s np.abs() function calculates the absolute value of all elements in an array. The absolute value is simply the distance of a number from zero on the number line, regardless of its sign.
🌐
NumPy
numpy.org › doc › 1.15 › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v1.15 Manual
numpy.absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'absolute'>¶
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python numpy absolute value
Python NumPy Absolute Value - Spark By {Examples}
March 27, 2024 - An absolute value is a positive value of a given negative value, so it just removes the negative sign from the input value. ... The NumPy absolute() function takes four parameters arr, out, where, and dtype, and returns a new array with an argument ...
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v2.0 Manual
An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\).
🌐
Sharp Sight
sharpsight.ai › blog › numpy-absolute-value
Numpy Absolute Value, Explained - Sharp Sight
July 24, 2021 - The output is a new Numpy array that has the same shape. The values of the new Numpy are the absolute values of the values of the input array. Now that we’ve looked at a few examples, let me answer a common question about np absolute value.
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v2.3 Manual
An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is \(\sqrt{ a^2 + b^2 }\).
🌐
SciPy
docs.scipy.org › doc › numpy-1.11.0 › reference › generated › numpy.absolute.html
numpy.absolute — NumPy v1.11 Manual
May 29, 2016 - Calculate the absolute value element-wise · An ndarray containing the absolute value of each element in x. For complex input, a + ib, the absolute value is
🌐
GeeksforGeeks
geeksforgeeks.org › numpy-absolute-python
numpy.absolute() in Python - GeeksforGeeks
November 29, 2018 - numpy.allclose() function is used to find if two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(arr2)) and the absolute difference atol are added together to compare against the absolute differenc