Let's say I got this
a = np.arange(9).reshape((3,3))
I want get a numpy array of [9,12,15]
which is a result of
[0+3+6, 1+4+7, 2+5+8]
You can usenumpy.array.sum()
function by passing the axis=0
:
>>> a.sum(axis=0)
array([ 9, 12, 15])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With