O'Reilly logo

Hands-On Data Analysis with NumPy and pandas by Curtis Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Advanced indexing

Let's now discuss more advanced indexing techniques. We can index ndarray objects using other ndarray. We can slice an ndarray using either ndarray objects containing integers that correspond to the indices of the ndarray we wish to select, or ndarray objects of Boolean values, where the value true means a cell should be included in the slice.

Select the elements of arr2 that are not Wayne, and this is the result:

Wayne is not included in the selection, and this was the array that was generated to do that indexing:

It is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required