# NumPy Arithmetic and Statistics - Comparison and Boolean Masks

## We'll cover the following

## 3. Comparisons and Boolean Masks

### a. Comparisons

*In this world reigned by the social media, the trap of making comparisons is just about everywhere. So, staying true to the culture of making comparisons, let’s talk about comparisons in NumPy*

NumPy provides comparison operators such as *less than* and *greater than* as element-wise functions. The result of these comparison operators is always an array with a Boolean data type, i.e., we get boolean array as output which contains only True and False values depending on whether the element at that index lives up to the comparison or not. Let’s see this in action with some examples.

Run the code in the widget below and observe the outputs of the print statements to understand is going on.

Get hands-on with 1200+ tech skills courses.