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.