import numpy as np #Syntax: numpy.sum(a, axis=None, dtype=None, out=None, keepdims=<class numpy._globals._NoValue at 0x40b6a26c>)
计算中所有元素的值
Example:
a = [1,2] print np.sum(a) #3 a = np.matrix('1,2;3,4') print np.sum(a) #10 print np.sum(a, axis=0) #[4, 6] print np.sum(a, axis = 1) #[3, 7]