Broadcasting NumPy Arrays
In the previous mission, we've learned that we can perform arithmetic operations between ndarrays of the same shape.
In this mission, we will learn that these operations can also be performed between ndarrays of different shape, for as long as a set of rules is verified.
In particular, you'll:
- Learn how to perform arithmetic operations between ndarrays and values. For example, how to add a fixed value to each entry of an ndarray.
- Learn how to perform arithmetic operations between 1-dimensional arrays and 2-dimensional arrays.
- Learn how to change the shape of an ndarray.
Now, imagine that we want to increase every entry in an ndarray by one. How do we do that? In this mission, we'll cover that and much more!
As with all Dataquest missions, this is an interactive learning experience. You'll be writing real Python code and using NumPy in our browser-based coding environment so there's no setup and no obstacles between you and learning!
- Broadcasting with a Single Value
- Broadcasting Mental Model
- Broadcasting Horizontally
- Broadcasting Vertically
- Broadcasting on Both
- Broadcasting Rules
- Compatible Shapes
- Next Steps