Summary

In this chapter, we covered the basic operations of NumPy and its ufuncs. We took a look at the huge difference between NumPy operations and Python looping. We also took a look at how broadcasting works and what we should avoid. We tried to understand the concept of masking as well.

The best way to use NumPy Arrays is to eliminate loops as much as you can and use ufuncs in NumPy instead. Keep in mind the broadcasting rules and use them with care. Using slicing and indexing with masking makes your code more efficient. Most importantly, have fun while using it.

In the next few chapters, we will cover the core libs of NumPy, including date/time and a file I/O to help you extend your NumPy experience.

Get NumPy Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.