本文共 839 字,大约阅读时间需要 2 分钟。
cumprod()累积连乘
Series.cumprod(axis=None, skipna=True, *args, **kwargs)#实现功能:Return cumulative product over a DataFrame or Series axis.#实现功能:Returns a DataFrame or Series of the same size containing the cumulative product.#return:scalar or Series
cumsum()累积连加
Series.prod(axis=None, skipna=None, level=None, numeric_only=None, min_count=0, **kwargs)# 实现功能:Return the product of the values for the requested axis.# return:scalar or Series
优点没看明白,因为常规情况下,所用的.prod()并非pandas下的函数,而是numpy下的函数。
numpy.prod(a, axis=None, dtype=None, out=None, keepdims=<class numpy._globals._NoValue>)# 实现功能:Return the product of array elements over a given axis.# return:product_along_axis : ndarray
返回给定轴上数组元素的乘积。
跟cumprod不同,cumprod是计算当前一个累积乘上前面所有的数据,更多是一个list;prod返回的是给定这个轴上最终一个值。
.
.
.
2019-03-22 16:24:33写于上海
转载地址:http://xgge.baihongyu.com/