Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 567 Bytes

get-numpy-shape.md

File metadata and controls

28 lines (22 loc) · 567 Bytes

Get Numpy array shape

import numpy as np
arr = np.array([[1, 2], [3, 4], [5, 6]])
shp = arr.shape
  • import numpy as np - load lib:Numpy module for Python
  • np.array - declare Numpy array
  • [[1, 2], [3, 4], [5, 6]] - sample multi-dimensional array
  • .shape - attribute returns shape of given array

group: shape

Example:

import numpy as np
arr = np.array([[1, 2], [3, 4], [5, 6]])
shp = arr.shape
print(shp)
(3, 2)

link_youtube: https://youtu.be/ZZgpE5EQ_J8