prod()与cumprod()区别cumsum()
发布日期:2021-05-07 14:28:36 浏览次数:10 分类:原创文章

本文共 839 字,大约阅读时间需要 2 分钟。

  • pandas.Series.cumprod

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()累积连加

  • pandas.Series.prod
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
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写于上海

上一篇:服务器常用术语汇总||实例||ECS||公IP...
下一篇:np.where()详解||做量化知道这些就够了

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2025年03月24日 07时37分19秒