The built-in max takes a key function, you can pass that as abs:

>>> max([3, 7, -10], key=abs)
-10

You can call abs again on the result to normalise the result:

>>> abs(max([3, 7, -10], key=abs))
10
Answer from Moses Koledoye on Stack Overflow
🌐
Profound Academy
profound.academy › python-introduction › min-max-abs-DZ25fuVqi5ass7kZdK1v
min max abs - Introduction to Python
November 1, 2024 - When dealing with computations, in many cases it’s required to compute min or max values among several values. To help with those operations python provides built-in functions min(), max(), and abs() to compute the minimum, maximum, and the absolute value correspondingly.
Discussions

python - How to find values with minimal absolute values in several columns ignoring NaNs? - Stack Overflow
I have the following two pandas time series (but the question is also applicable to numpy array): NaN NaN NaN 2 NaN 1 NaN 0 NaN ... More on stackoverflow.com
🌐 stackoverflow.com
math - Elegant mechanism to determine smallest magnitude number but preserve sign in Python - Stack Overflow
I have a Pythonic need to determine the minimum number in terms of absolute value, but preserve its sign. Below is the code I use to do this now. Is there a more elegant mechanism either More on stackoverflow.com
🌐 stackoverflow.com
python - How to get the value with the smaller absolute value from a panda Series - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
September 1, 2019
vectorization - numpy: minimal absolute value above threshold - Stack Overflow
Above code returns the absolute minimum over the last dimension. But I'd like to ignore small values (near 0) from determining the minimum. So in my example with tolerance = 0.1 the third row should contain the second smallest value. More on stackoverflow.com
🌐 stackoverflow.com
November 13, 2021
🌐
Blender Artists
blenderartists.org › coding › python support
lowest absolute value - Python Support - Blender Artists Community
December 28, 2016 - I tried x = min(abs(a), abs(b), abs(c), abs(d)) the problem is this way I lose the pos/neg sign So, I ended up doing this: if abs(a) <= abs(b): x = a if abs(a) <= abs(c): x = a if abs(a) <= abs(d): x = a else: x = d else: x = c else: x = b if ...
🌐
alpharithms
alpharithms.com › home › articles › programming › python abs(): the absolute value built-in function
Python abs(): The Absolute Value Built-in Function - αlphαrithms
June 16, 2022 - The Python abs() function is part of the standard built-in functions and provides a utility to calculate an absolute value. This function can be used to convert static values to their absolute value as well as dynamic values. In this article, I’ll cover the basic syntax used for Python’s absolute value function, how to use […]
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › minimum-absolute-value-of-k-arri-for-all-possible-values-of-k-over-the-range-0-n-1
Minimum absolute value of (K – arr[i]) for all possible values of K over the range [0, N – 1] - GeeksforGeeks
July 23, 2025 - # Python program for the above approach # Function to find the minimum absolute # value of (K - arr[i]) for each possible # value of K over the range [0, N - 1]| def minimumDistance(arr, N): ind = 0; prev = arr[ind]; s = len(arr); # Traverse ...
🌐
Real Python
realpython.com › python-absolute-value
How to Find an Absolute Value in Python – Real Python
June 4, 2025 - In this case, you take a squared number to the power of one-half (0.5) or one over two (½), which is the same as calculating the square root. Note that both Python implementations based on the algebraic definition suffer from a slight deficiency: ... >>> def absolute_value(x): ...
Find elsewhere
🌐
Programiz
programiz.com › python-programming › methods › built-in › abs
Python abs()
Become a certified Python programmer. Try Programiz PRO! ... The abs() function returns the absolute value of the given number.
🌐
PyQuestHub
pyquesthub.com › understanding-basic-math-operations-in-python-with-abs-min-and-max-functions
Basic Math Operations in Python: Using abs, min, and max Functions
November 21, 2024 - Using the abs function: The abs() function takes a number as input and returns its absolute value. In the example, we assign the value -10 to the variable negative_number, and calling abs(negative_number) gives us 10. Using the min function: The min() function is used to find the smallest number from a list of numbers...
🌐
W3Schools
w3schools.com › python › ref_func_abs.asp
Python abs() Function
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... The abs() function returns the absolute value of the specified number.
🌐
Dfrieds
dfrieds.com › python › minimum-absolute-difference.html
Minimum Absolute Difference (via Leetcode) - dan_friedman_learnings
# if absolute difference of pair is equal to min_absolute_difference: # append pair as list to min_pairs_list # else if absolute difference pair is less than min_absolute_difference: # reassign min_absolute_difference to be new absolute difference of pair # if min_pairs_list is empty: # append pair as list to min_pairs_list # else: # we don't want to keep old pairs in min_pairs_list that contain higher abs value among pairs...
🌐
TradingCode
tradingcode.net › python › math › rare-absolute
Absolute values of uncommon Python values • TradingCode
When we use Python’s abs() function, we often work with integers and floating-point value. But abs() has a less-known feature: it can also work with uncommon values. Let’s have a look. In Python, we get the absolute value of numbers with the abs() function.
🌐
Server Academy
serveracademy.com › blog › python-absolute-value-abs-tutorial
Python Absolute Value Abs() Tutorial - Server Academy
November 12, 2024 - For example, the absolute value ... normalization. In Python, the simplest way to calculate the absolute value is to use the abs() function....
🌐
DataCamp
datacamp.com › tutorial › python-absolute-value-a-quick-tutorial
Python Absolute Value: A Quick Tutorial | DataCamp
April 11, 2024 - Learn how to use Python's abs function to get a number's magnitude, ignoring its sign. This guide explains finding absolute values for both real and imaginary numbers, highlighting common errors.
🌐
LearnDataSci
learndatasci.com › solutions › python-absolute-value
Python Absolute Value – abs() for real and complex numbers – LearnDataSci
The sign of the number alludes to which direction along the line the number is; positive values are along the positive axis, and negative ones are along the negative axis. In the quick example shown in the introduction, -5 is a real number. In regards to Python, real numbers are numbers that are integers or floats. The following example demonstrates how we can apply the abs function to a list of integers: real_number_list = [-12, -6, 0, 4, 8] for number in real_number_list: absolute_value = abs(number) print(f'Number: {number}, Absolute Value: {absolute_value}')
🌐
Career Karma
careerkarma.com › blog › python › python absolute value: a step-by-step guide
Python Absolute Value: A Step-By-Step Guide | Career Karma
December 1, 2023 - The Python abs() method returns the absolute value of a number. The absolute value of a number is the number’s distance from 0. This makes any negative number positive, while positive numbers are unaffected.