eland.groupby.DataFrameGroupBy.median¶
-
DataFrameGroupBy.
median
(numeric_only: bool = True) → pd.DataFrame¶ Compute the median 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
See also
Examples
>>> df = ed.DataFrame( ... "localhost", "flights", ... columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"] ... ) >>> df.groupby("DestCountry").median(numeric_only=False) # doctest: +SKIP AvgTicketPrice Cancelled dayOfWeek timestamp DestCountry AE 585.720490 False 2 2018-01-19 23:56:44.000 AR 678.447433 False 3 2018-01-22 10:18:50.000 AT 659.715592 False 3 2018-01-20 20:40:10.000 AU 689.241348 False 3 2018-01-22 18:46:11.000 CA 663.516057 False 3 2018-01-22 21:35:09.500 ... ... ... ... ... RU 670.714956 False 3 2018-01-20 16:48:16.000 SE 680.111084 False 3 2018-01-22 20:53:44.000 TR 441.681122 False 1 2018-01-13 23:17:27.000 US 600.591525 False 3 2018-01-22 04:09:50.000 ZA 633.935425 False 3 2018-01-23 17:42:57.000 <BLANKLINE> [32 rows x 4 columns]