Why is it that:
a = [1, 2 ,3]
b = [3, 4, 5]
t= np.vstack([a,b])
print(t) # 1D array of 2 elements each of size 3
print(t[0]) # first elem of 1D array
print(t[0:]) # first row of 1D array
print(t[1:]) # ?
u = np.array([[6, 7 ,8], [9, 10, 11]])
print(u) # 1D array of 2 elements each of size 3
print(u[0]) # first elem of 1D array
print(u[0:]) # first row of 1D array
print(u[1:]) # ?
prints in last line entire array instead of only first row?
[[1 2 3]
[3 4 5]]
[1 2 3]
[[1 2 3]
[3 4 5]]
[[3 4 5]]
[[ 6 7 8]
[ 9 10 11]]
[6 7 8]
[[ 6 7 8]
[ 9 10 11]]
[[ 9 10 11]]
Why the t[1:]
in each case gives the second elem. of 1D array as it should give the second row of multidim array?