Array elements extraction
The NumPy extract()
function allows us to extract items from an array based on a condition. This function is similar to the where()
function we encountered in Chapter 3, Getting Familiar with Commonly Used Functions. The special nonzero()
function selects non-zero elements.
Get NumPy : Beginner's Guide - Third Edition 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.