Filtering Rows with a Condition

A comparison such as products["price"] < 100 gives a True or False answer for every row, called a mask; putting the mask in square brackets, products[mask], keeps only the rows where it is True; and sum() and mean() on the mask count the matching rows and give their share of the table.

By

Updated

Cheat sheet: Filtering Rows with a Condition
Category
Data Analysis
Level
Apprentice
Tags
Boolean (general), Boolean Mask, Comparison Operators (python), python