AI engineering glossary · NumPy pandas visualization

What is boolean mask?

Boolean mask (also called boolean indexing in NumPy): An array of True and False values with the same shape as another array, used to select only the elements where the mask is True. It is built by applying a comparison to the whole array and is the main way to filter numerical data without a loop.

Level: beginnerTopic: NumPy pandas visualization

Boolean mask: an example

scores[scores > 60] returns only the scores above 60, and (scores > 60).sum() counts how many there are.

Related terms

More NumPy pandas visualization terms

Where you learn it

Boolean mask is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.