eland.DataFrame.median#
- DataFrame.median(numeric_only: Optional[bool] = None) Series #
返回每个数字列的中位数
参数#
- numeric_only: {True, False, None} 默认为 None
要返回的数据类型 - True: 将所有值返回为 float64,NaN/NaT 值将被移除 - None: 尽可能将所有值返回为相同的数据类型,NaN/NaT 将被移除 - False: 尽可能将所有值返回为相同的数据类型,NaN/NaT 将被保留
返回值#
- pandas.Series
每个数字列的中位数
另请参见#
示例#
>>> df = ed.DataFrame('http://localhost:9200', 'flights', columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"]) >>> df.median() AvgTicketPrice 640.363 Cancelled False dayOfWeek 3 timestamp 2018-01-21 23:54:06.624776611 dtype: object
>>> df.median(numeric_only=True) AvgTicketPrice 640.362667 Cancelled 0.000000 dayOfWeek 3.000000 dtype: float64
>>> df.median(numeric_only=False) AvgTicketPrice 640.387 Cancelled False dayOfWeek 3 timestamp 2018-01-21 23:54:06.624776611 DestCountry NaN dtype: object