Array Shapes, Axes, and Broadcasting
To work effectively with NumPy operations, itβs essential to understand shapes and axes β the core concepts that define array structure.
Shapeβ
Every array has a .shape, which shows how many elements it has in each dimension.
For example, an array with 2 rows and 3 columns has a shape of (2, 3).
Axesβ
An axis represents the direction along which a NumPy function performs its operation.
axis=0: down the rows (vertical)axis=1: across the columns (horizontal)
You will use axes with functions like sum(), mean(), and others.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.