pyspark.pandas.DataFrame.abs¶
-
DataFrame.
abs
() → FrameLike¶ Return a Series/DataFrame with absolute numeric value of each element.
- Returns
- absSeries/DataFrame containing the absolute value of each element.
Examples
Absolute numeric values in a Series.
>>> s = ps.Series([-1.10, 2, -3.33, 4]) >>> s.abs() 0 1.10 1 2.00 2 3.33 3 4.00 dtype: float64
Absolute numeric values in a DataFrame.
>>> df = ps.DataFrame({ ... 'a': [4, 5, 6, 7], ... 'b': [10, 20, 30, 40], ... 'c': [100, 50, -30, -50] ... }, ... columns=['a', 'b', 'c']) >>> df.abs() a b c 0 4 10 100 1 5 20 50 2 6 30 30 3 7 40 50