Tsallaka zuwa abun ciki
Justice Tech School

Array Attributes

ndim, shape, size, dtype and itemsize describe an array. shape is a tuple with the length of each dimension.

Example
import numpy as np
a = np.array([[1, 2, 3], [4, 5, 6]])
print(a.ndim, a.shape, a.size)
print(a.dtype, a.itemsize)

Result

2 (2, 3) 6
int64 8

Exercise

Get the shape.

a.

Quiz Test

What is the shape of a 2 by 3 array?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.