eland.groupby.DataFrameGroupBy.mad

DataFrameGroupBy.mad(numeric_only: bool = True) → pd.DataFrame

Compute the median absolute deviation value for each group.

Parameters
numeric_only: {True, False, None} Default is True

Which datatype to be returned - True: Returns all values as float64, NaN/NaT values are removed - None: Returns all values as the same dtype where possible, NaN/NaT are removed - False: Returns all values as the same dtype where possible, NaN/NaT are preserved

Returns
pandas.DataFrame

median absolute deviation value for each numeric column of each group

Examples

>>> df = ed.DataFrame(
...   "localhost", "flights",
...   columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"]
... )
>>> df.groupby("DestCountry").mad() # doctest: +SKIP
             AvgTicketPrice  Cancelled  dayOfWeek
DestCountry
AE               233.697174        NaN        1.5
AR               189.250061        NaN        2.0
AT               195.823669        NaN        2.0
AU               202.539764        NaN        2.0
CA               203.344696        NaN        2.0
...                     ...        ...        ...
RU               206.431702        NaN        2.0
SE               178.658447        NaN        2.0
TR               221.863434        NaN        1.0
US               228.461365        NaN        2.0
ZA               192.162842        NaN        2.0
<BLANKLINE>
[32 rows x 3 columns]