eland.DataFrame.sum#

DataFrame.sum(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

每个数值列的总和

另请参阅#

pandas.DataFrame.sum

示例#

>>> df = ed.DataFrame('http://localhost:9200', '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