>>> 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]) # 计算累加和,1=1,3=1+2,6=1+2+3....
原文地址:https://www.cnblogs.com/pjishu/p/10447188.html
时间: 2024-11-03 15:31:47
>>> 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]) # 计算累加和,1=1,3=1+2,6=1+2+3....
原文地址:https://www.cnblogs.com/pjishu/p/10447188.html