Pandas DataFrame abs() Method
Example
Find the absolute value of each value in the DataFrame:
import pandas as pd
data = [[-50, 40, 30], [-1, 2, -2]]
df =
pd.DataFrame(data)
print(df.abs())
Try it Yourself »
Definition and Usage
The abs()
method returns a DataFrame with
the absolute value of each value.
Syntax
dataframe.abs()
Parameters
This method takes no parameters.
Return Value
A DataFrame object with absolute values.
This function does NOT make changes to the original DataFrame object.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.