eland.DataFrame.mean#
- DataFrame.mean(numeric_only: Optional[bool] = None) Series #
返回每个数字列的平均值
TODO - 实现其余的 pandas 参数,目前不支持非数字
参数#
- 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.mean() AvgTicketPrice 628.254 Cancelled 0.128494 dayOfWeek 2.83598 timestamp 2018-01-21 19:20:45.564438232 dtype: object
>>> df.mean(numeric_only=True) AvgTicketPrice 628.253689 Cancelled 0.128494 dayOfWeek 2.835975 dtype: float64
>>> df.mean(numeric_only=False) AvgTicketPrice 628.254 Cancelled 0.128494 dayOfWeek 2.83598 timestamp 2018-01-21 19:20:45.564438232 DestCountry NaN dtype: object