pandas.Series.abs

Return a Series/DataFrame with absolute numeric value of each element.

This function only applies to elements that are all numeric.

return

abs Series/DataFrame containing the absolute value of each element.

Examples

Getting the absolute value of each element in Series
import pandas as pd
from numba import njit


@njit
def series_abs():
    s = pd.Series([-1.10, 2, -3.33])
    out_series = s.abs()

    return out_series  # Expect series of 1.10, 2.00, 3.33


print(series_abs())
$ python ./series/series_abs.py
0    1.10
1    2.00
2    3.33
dtype: float64

See also

numpy.absolute

Calculate the absolute value element-wise.