当前位置:网站首页>numpy.cumsum
numpy.cumsum
2022-07-24 07:23:00 【Wanderer001】
Reference resources numpy.cumsum - cloud + Community - Tencent cloud
numpy.cumsum(a, axis=None, dtype=None, out=None)[source]
Return the cumulative sum of the elements along a given axis.
Parameters
aarray_like
Input array.
axisint, optional
Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.
dtypedtype, optional
Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.
outndarray, optional
Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output but the type will be cast if necessary. See ufuncs-output-type for more details.
Returns
cumsum_along_axisndarray.
A new array holding the result is returned unless out is specified, in which case a reference to out is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1-d array.
See also
Sum array elements.
Integration of array values using the composite trapezoidal rule.
Calculate the n-th discrete difference along given axis.
Notes
Arithmetic is modular when using integer types, and no error is raised on overflow.
Examples
>>> a = np.array([[1,2,3], [4,5,6]])
>>> a
array([[1, 2, 3],
[4, 5, 6]])
>>> np.cumsum(a)
array([ 1, 3, 6, 10, 15, 21])
>>> np.cumsum(a, dtype=float) # specifies type of output value(s)
array([ 1., 3., 6., 10., 15., 21.])>>> np.cumsum(a,axis=0) # sum over rows for each of the 3 columns
array([[1, 2, 3],
[5, 7, 9]])
>>> np.cumsum(a,axis=1) # sum over columns for each of the 2 rows
array([[ 1, 3, 6],
[ 4, 9, 15]])边栏推荐
- cookie_session
- C language to achieve three chess? Gobang? No, it's n-chess
- numpy.inf
- The goal you specified requires a project to execute but there is no POM in this directory
- Basic syntax of MySQL DDL and DML and DQL
- Opencascade notes: GP package
- Mqtt learning
- Blockbuster live broadcast | orb-slam3 series code explanation map points (topic 2)
- 从CIA看常见网络攻击(爆破,PE,流量攻击)
- Part II - C language improvement_ 3. Pointer reinforcement
猜你喜欢

Chapter007 FPGA learning IIC bus EEPROM reading
![[line test] Figure finding regular questions](/img/61/d1c2cd399cf0d808e4fa25cd5fe681.png)
[line test] Figure finding regular questions

单点登录的三种实现方式

In the era of e-commerce, what should enterprises do in the transformation of social e-commerce?

QoS quality of service three DiffServ Model message marking and PHB

My creation anniversary

C language from entry to soil (I)

MITRE ATT&CK超详细学习笔记-02(大量案例)

变量和数据类型(03)
![[steering wheel] the super favorite idea efficiency artifact save actions is uninstalled](/img/b0/54a826287154be5b758b3850e7fa51.png)
[steering wheel] the super favorite idea efficiency artifact save actions is uninstalled
随机推荐
一个怎样的模式能让平台用户发生自助裂变?-链动2+1
php 转义字符串
Buddy: core function entry
[steering wheel] code review ability of idea to ensure code quality
给一个字符串 ① 请统计出其中每一个字母出现的次数② 请打印出字母次数最多的那一对
论文阅读:HarDNet: A Low Memory Traffic Network
【时序逻辑电路】——寄存器
Seminar 2022.07.22 -- Comparative learning
baddy:核心函数入口
[leetcode] 11. Container with the most water - go language solution
周杰伦直播超654万人观看,总互动量破4.5亿,助力快手再破纪录
我的创作纪念日
Wild pointer, null pointer, invalid pointer
第二部分—C语言提高篇_3. 指针强化
AMD64 (x86_64) architecture ABI document: upper
OpenCascade笔记:gp包
[FreeRTOS] 11 software timer
UNI-APP_小程序或h5页面背景音乐的播放与暂停
中国三氯氢硅市场预测及战略研究报告(2022版)
[tips] a simple method to create a version control project