Numpy Sum Axis Intuition
Aug 26, 2017 · 2 min read
I’ve always thought that axis 0 is row-wise, and 1 is column-wise.
row-wise (axis 0) ---> [[ 0 1]
[ 0 5]]
âˇ
|
column-wise (axis 1)However, the result of numpy.sum is the exact opposite of what I was thinking.
>>> np.sum([[0, 1], [0, 5]], axis=0)
array([0, 6])>>> np.sum([[0, 1], [0, 5]], axis=1)
array([1, 5])

