Question: import numpy as np x = np.array([1,2,3]) y = x[np.newaxis,:][np.newaxis,:,:] print(y.shape) Please explain why this prints out (1,1,3) and not (3,3,3) because from what I
import numpy as np x = np.array([1,2,3]) y = x[np.newaxis,:][np.newaxis,:,:] print(y.shape)
Please explain why this prints out (1,1,3) and not (3,3,3) because from what I understand, shape is like (number of arrays, rows, coloums). If I am wrong please correct me and let me know how I can understand np.shape better.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
