Skip to content

LazyColumn.abs

abs

abs() -> LazyColumn

Returns the absolute value of each element in this column.

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn where all numeric values are converted to their absolute value. Null values remain null.

Examples:

print(df.head())
# Example output (illustrative):
#    col1  my_column_to_test
# 0     1                 -4
# 1     2                  0
# 2     3                 -2
# 3     4                  5
# 4     5                 -6

# Performing the operation on the column
df["my_column_to_test"].abs()
# Expected output (LazyColumn in lazy mode):
# [4, 0, 2, 5, 6]