1. You can use abs and map functions like this

     myList = [2,3,-3,-2]
     print(list(map(abs, myList)))
    

Output

    [2, 3, 3, 2]
  1. Or you can use list comprehension like this

     [abs(number) for number in myList]
    
  2. Or you can use list comprehension and a simple if else condition like this

     [-number if number < 0 else number for number in myList]
    
Answer from thefourtheye on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-absolute-value-of-list-elements
Absolute Value of List Elements - GeeksforGeeks
July 12, 2025 - List comprehension is used here to apply the abs() function to each element of the list li creating a new list a that contains absolute values of original list. It iterates over li in a single line transforming each element and efficiently ...
Discussions

Absolute value of a value in List in Python - Stack Overflow
In Python, how do convert all the values in a list to their abs values? I would like a deep copy of the original list with the absolute values. say a=[['2.40', '1970-1990', 'Austria']] I just w... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Using LARGE to return a sorted list of absolute values

Well, here's the extremely convoluted formula that did the trick, in case anyone's interested.

=INDEX($C$2:$C$17,SMALL(IF(LARGE(IF($B$2:$B$17="A",ABS($C$2:$C$17),""),ROW(1:1))=ABS($C$2:$C$17),SEQUENCE(ROWS($B$2:$B$17),1,1,1),""),1+SUMPRODUCT(--(IFERROR(ABS($G$1:G1),"")=LARGE(IF($B$2:$B$17="A",ABS($C$2:$C$17),""),ROW(1:1))))))
More on reddit.com
๐ŸŒ r/excel
1
1
February 11, 2019
Sort a column of values by their absolute value
Create a new table with a column that have absolute value of the % column, then create a relationship between the 2 table and sort the original table by the new table's absolute value column? More on reddit.com
๐ŸŒ r/PowerBI
2
1
October 4, 2019
Pulp constrains operations
Looks like pulp does linear and integer programming. Your problem isn't linear, so you either linearize it or abandon pulp for eg a branch and bound algorithm. You can try googling "linearize absolute value" etc and see how far you can get, but from the looks of your problem that'll be a long road. You will probably get better answers in a math subreddit. More on reddit.com
๐ŸŒ r/learnpython
3
1
November 8, 2017
๐ŸŒ
datagy
datagy.io โ€บ home โ€บ python posts โ€บ python absolute value: abs() in python
Python Absolute Value: Abs() in Python โ€ข datagy
December 15, 2022 - We looped over our list containing our numbers and calculated its absolute value using the abs() function ... Want to learn more about Python for-loops? Check out my in-depth tutorial that takes your from beginner to advanced for-loops user!
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Get Absolute Values in Python: abs(), math.fabs() | note.nkmk.me
May 11, 2025 - Here's a simple example where abs() always returns 100: class MyClass: def __abs__(self): return 100 mc = MyClass() print(abs(mc)) # 100 ... To convert all elements in a list to their absolute values, you can use a list comprehension with abs().
๐ŸŒ
Real Python
realpython.com โ€บ python-absolute-value
How to Find an Absolute Value in Python โ€“ Real Python
June 4, 2025 - To calculate the absolute value of a list of numbers in Python, you can use a list comprehension or the map() function to apply abs() to each element in the list.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_func_abs.asp
Python abs() Function
Remove List Duplicates Reverse ... Q&A Python Bootcamp Python Certificate Python Training ... The abs() function returns the absolute value of the specified number....
๐ŸŒ
LearnDataSci
learndatasci.com โ€บ solutions โ€บ python-absolute-value
Python Absolute Value โ€“ abs() for real and complex numbers โ€“ LearnDataSci
As magnitude is just a distance, it will always be positive. We can also use the abs() function on floats. See below for an example of this: real_number_list = [-4.16, -3.12, 11.88, 16.32] for number in real_number_list: absolute_value = abs(number) print(f'Number: {number}, Absolute Value: ...
Find elsewhere
๐ŸŒ
Iq-inc
iq-inc.com โ€บ python-absolute-value
Python Absolute Value โ€“ IQ Inc
May 19, 2021 - This is a Python built-in function that is always available. abs(0.1) # 0.1 abs(-0.1) # 0.1 abs(-5) # 5 abs(-1e3) # 1000.0 ยท Sometimes though you might need to get the absolute value from every element in a list.
๐ŸŒ
TradingCode
tradingcode.net โ€บ python โ€บ math โ€บ absolute-value
How to get absolute value of numbers in Python? โ€ข TradingCode
Hereโ€™s how that looks: # Some positive and negative values values = [-40, 58, -69, -84, 51, 76, -12, 36] # Loop through the list and replace # each number with its absolute value for index, value in enumerate(values): values[index] = abs(value)
๐ŸŒ
YouTube
youtube.com โ€บ watch
How To Get Absolute Values in Python - YouTube
abs() is a Python built in function that finds the absolute value of a number. abs() can be combined with map() to get the absolute values of all numbers in ...
Published ย  March 26, 2021
๐ŸŒ
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.
๐ŸŒ
SciPy
docs.scipy.org โ€บ doc โ€บ numpy-1.13.0 โ€บ reference โ€บ generated โ€บ numpy.absolute.html
numpy.absolute โ€” NumPy v1.13 Manual
numpy.absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'absolute'>ยถ
๐ŸŒ
Python Guides
pythonguides.com โ€บ python-absolute-value
Get Absolute Value in Python Without Using abs() Function
October 1, 2025 - Learn how to get the absolute value in Python without using the built-in abs() function. Explore simple methods with practical examples and explanations.
๐ŸŒ
Finxter
blog.finxter.com โ€บ 5-best-ways-to-convert-a-python-list-to-absolute-values
5 Best Ways to Convert a Python List to Absolute Values โ€“ Be on the Right Side of Change
Looping through each element in a list and applying the abs() function is the most straightforward approach to converting a list to absolute values. This method is simple and easily understandable even for beginners to Python.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-compute-the-absolute-values-of-a-2d-array-in-python
How to compute the absolute values of a 2D array in Python
numpy.absolute(arr,out=None, where=True,casting='same_kind', order='K', dtype=None,subok=True[, signature, extobj]) - <ufunc absolute'>) ... where: This represents the condition in which the input gets broadcasted. This is an optional parameter. casting: This specifies the kind of casting that is allowed. The value may be no, equiv, safe, same_kind, or unsafe. This is an optional parameter. order: This defines the output arrayโ€™s memory layout and calculation iteration order. Its default value is K.
๐ŸŒ
Replit
replit.com โ€บ home โ€บ discover โ€บ how to do absolute value in python
How to do absolute value in Python
February 6, 2026 - While the built-in abs() function is your go-to, exploring other methods can deepen your understanding of Python's flexibility and the logic behind the calculation. number = -15 if number < 0: absolute_value = -number else: absolute_value = ...
๐ŸŒ
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....