To work with an array effectively, you need to know its structure. ndim, shape, size, dtype tell you how many dimensions the array has, how many rows/columns, how many elements, and what data type it holds.
import numpy as np
scores = np.array([[80, 75, 90], [88, 92, 85]])
print("Dimensions:", scores.ndim)
print("Shape:", scores.shape)
print("Total items:", scores.size)
print("Data type:", scores.dtype)This array has 2 rows and 3 columns. scores.ndim tells you it's a 2-D array. scores.shape gives you (2, 3), the row/column counts. size shows there are 6 elements total.
Dimensions: 2 Shape: (2, 3) Total items: 6 Data type: int64Info
shape is one of the most important basics to understand in NumPy. Broadcasting, reshaping, and matrix multiplication all tend to throw errors when shapes don't match up.