|
・In Japanese
■Description of the shape function
Returns the shape of the array. A similar function is reshape, which is a function that changes the shape of an array.
■Specific example using shape function
The following is a mandatory description when using numpy.
example①
a=np.array([1,2,3,4,5,6,7,8,9,10,11,12])
a.shape
⇒ (12,)
example②
a=np.array([[1,2,3],[4,5,6]])
a.shape
⇒ (2, 3)
When extracting each value separately, it is as follows.
b=a.shape[0]
b
⇒ 2
b , c =a.shape
b
⇒ 2
c
⇒ 3
|
|