DataFrame.sum
- DataFrame.sum(numeric_only: bool | None = None) Series
Return sum 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
sum for each numeric column
See Also
Examples
>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(OPENSEARCH_TEST_CLIENT, 'flights', columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"]) >>> df.sum() AvgTicketPrice 8.20436e+06 Cancelled 1678 dayOfWeek 37035 dtype: object
>>> df.sum(numeric_only=True) AvgTicketPrice 8.204365e+06 Cancelled 1.678000e+03 dayOfWeek 3.703500e+04 dtype: float64
>>> df.sum(numeric_only=False) AvgTicketPrice 8.20436e+06 Cancelled 1678 dayOfWeek 37035 timestamp NaT DestCountry NaN dtype: object