Guided Notes
Creating Arrays, Shapes & Data Types
0-D to n-D arrays, helper functions for creating arrays, dimensions, and data types.
Dimensions
Slide 1 / 5An array's dimensions are its levels of nesting:
β’ 0-D β a single value: np.array(42) β’ 1-D β a row of values: np.array([1, 2, 3]) β’ 2-D β rows and columns (a matrix): np.array([[1, 2, 3], [4, 5, 6]]) β’ 3-D β a stack of 2-D arrays, like an RGB image (height Γ width Γ 3 colors).
arr.ndim reports how many dimensions an array has. np.array([1, 2, 3], ndmin=3) forces extra dimensions.
