pyspark.pandas.DataFrame.mad

DataFrame.mad(axis: Union[int, str] = 0) → Series[source]

Return the mean absolute deviation of values.

Deprecated since version 3.4.0.

Parameters
axis{index (0), columns (1)}

Axis for the function to be applied on.

Examples

>>> df = ps.DataFrame({'a': [1, 2, 3, np.nan], 'b': [0.1, 0.2, 0.3, np.nan]},
...                   columns=['a', 'b'])
>>> df.mad()
a    0.666667
b    0.066667
dtype: float64
>>> df.mad(axis=1)  
0    0.45
1    0.90
2    1.35
3     NaN
dtype: float64