Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

what does .shape do in python

#The shape attribute for numpy arrays returns the dimensions of the array. 
#If Y has n rows and m columns, then Y. shape is (n,m) .
import numpy as np
arr= np.array([[6, 1, 2, 1],
               [5, 4, 6, 7,],
               [6, 7, 2, 1,]])
result = np.shape(arr)
print(result)
#will return (3,4)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
3+8 =