Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

shape of a NumPy array in Python

a = np.arange(3)
b = np.arange(12).reshape((3, 4))
c = np.arange(24).reshape((2, 3, 4))

# it returns the length of each dimension (=size function of MATLAB)
print(a.shape) # (3,)
print(b.shape) # (3, 4)
print(c.shape) # (2, 3, 4)
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #shape #NumPy #array #Python
ADD COMMENT
Topic
Name
3+6 =