I have recently learned NumPy array and I am confused axis=0 and axis =1 represent? I have searched on the internet and got that axis=0 represent rows and axis=1 represent columns but when I start doing some practice I got confused about how axis work differently on two different function np.delete() and np.sum()
#input
import numpy as np
arr = np.array([(1,2,3,4),(5,6,7,8),(9,10,11,12)])
print(arr)
print(np.sum(arr,0)[1])
#output
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]]
18
if axis=0 represent row then it should add 2nd row(row of index 1 ) i.e 5+6+7+8
but instead, it is adding 2nd column i.e 2+6+10
but when I use np.delete()
#input
print(np.delete(arr,2,0))
#output
[[1 2 3 4]
[5 6 7 8]]
here it is deleting 3rd row(row of index 2).
In the first case, axis=0 is working as a column and in the second it is working as row
can you tell me where am I wrong?