Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Pandas DataFrame abs() Method

❮ DataFrame Reference


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.


❮ DataFrame Reference