博客
关于我
prod()与cumprod()区别cumsum()
阅读量:339 次
发布时间:2019-03-04

本文共 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写于上海

转载地址:http://xgge.baihongyu.com/

你可能感兴趣的文章
Python:函数 ----》装饰器函数
查看>>
Python:面向对象
查看>>
Python练习题 :随机生成一批数
查看>>
Spring源码:prepareBeanFactory(beanFactory);方法
查看>>
Spring源码:initApplicationEventMulticaster源码解析
查看>>
AcWing 786: 第k个数
查看>>
AcWing 798. 差分矩阵
查看>>
AcWing 828. 模拟栈
查看>>
AcWing 845. 八数码(BFS)
查看>>
AcWing 849. Dijkstra求最短路 I(Dijkstra)
查看>>
AcWing 4. 多重背包问题(带有个数限制的完全背包问题dp)
查看>>
EventBus简单Demo实现
查看>>
监听CPU和内存占用率脚本
查看>>
添加Selinux权限
查看>>
ifconfig网络配置信息解析
查看>>
Linux下解压命令
查看>>
(2019.9.10测试可用)如何在Windows的cmd中使用ls命令
查看>>
多因子策略中的IC、IR是什么,以及如何计算
查看>>
pd.resample('B')指重采样为工作日
查看>>
债券中的久期是什么意思
查看>>