numpy.cumsum() numpy.cumsum(a, axis=None, dtype=None, out=None) axis=0,按照行累加。 axis=1,按照列累加。...---->>> a = np.array([[1,2,3], [4,5,6]])>>> a>>> np.cumsum(a)array([ 1, 3, 6, 10, 15, 21])>>>>>> np.cumsum...(a,axis=0) #按照行累加,行求和array([[1, 2, 3], [5, 7, 9]]) [1, 2, 3]------...|1 |2 |3 | [4, 5, 6]------> |5=1+4 |7=2+5 |9=3+6| >>> np.cumsum...|2+1 |3+2+1 | [4, 5, 6]------> |4 |4+5 |4+5+6 | >>> np.cumsum