Answers for "sum matrix columns numpy"

3

how to to get sum of column or row in numpy

np.sum([[0, 1], [0, 5]], axis=0)
#array([0, 6])

np.sum([[0, 1], [0, 5]], axis=1)
#array([1, 5])
Posted by: Guest on March-06-2021

Browse Popular Code Answers by Language