|
|
|
|
|
by Ultcyber
1995 days ago
|
|
(in np.sum) > The value of the axis argument is, as a matter of fact, the number of the index in question: The first index is axis=0, the second one is axis=1, and so on If I'm not wrong - this statement is wrong - the axis does not represent index (or otherwise it would be axis 0 = row, axis 1 = column). The actual idea behind is a little unintuitive, but explained well here: https://aerinykim.medium.com/numpy-sum-axis-intuition-6eb949... |
|
The axis argument gives the index of the axis along which your summate, and which therefore disappears after summation.
There might be a confusion about whether "axis 0" is rows or columns? Its length is the number of rows, but it "points" along columns.
I prefer just calling them axis 0, 1, 2, ... and avoid thinking about rows and columns in numpy, I've found that sometimes avoids confusion.