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.