DataFrame.mean

DataFrame.mean(numeric_only: bool | None = None) Series

Return mean value for each numeric column

TODO - implement remainder of pandas arguments, currently non-numerics are not supported

Parameters

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

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.Series

mean value for each numeric column

See Also

:pandas_api_docs:`pandas.DataFrame.mean`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, '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