Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

number of dimensions of NumPy array in Python

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

print(a.ndim) # 1
print(b.ndim) # 2
print(c.ndim) # 3
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #number #dimensions #NumPy #array #Python
ADD COMMENT
Topic
Name
4+5 =