Recall & Review
beginner
What is Boolean filtering in data analysis?
Boolean filtering is a way to select rows from a dataset where a condition is true. It uses True or False values to keep or remove data.
Click to reveal answer
beginner
How do you create a Boolean filter in Python with pandas?
You write a condition that compares data, like df['age'] > 30. This returns a series of True/False values used to filter rows.
Click to reveal answer
beginner
What does the expression df[df['score'] >= 50] do?
It selects all rows in df where the 'score' column is 50 or more, filtering out rows with scores less than 50.
Click to reveal answer
intermediate
Why use Boolean filtering instead of looping through data?
Boolean filtering is faster and simpler because it uses vectorized operations, which work on whole columns at once without explicit loops.
Click to reveal answer
intermediate
How can you combine multiple conditions in Boolean filtering?
Use & for AND, | for OR, and ~ for NOT, with each condition in parentheses. For example: df[(df['age'] > 20) & (df['score'] > 70)].
Click to reveal answer
What type of values does Boolean filtering use to select data?
✗ Incorrect
Boolean filtering uses True or False values to decide which rows to keep.
Which symbol is used for the AND operation in pandas Boolean filtering?
✗ Incorrect
In pandas, & is used for element-wise AND between conditions.
What does df[df['price'] < 100] return?
✗ Incorrect
This filters the DataFrame to only rows with price less than 100.
How do you negate a condition in Boolean filtering?
✗ Incorrect
The ~ symbol negates a Boolean condition in pandas.
Why is Boolean filtering preferred over loops in pandas?
✗ Incorrect
Boolean filtering is faster because it works on whole columns at once without explicit loops.
Explain how Boolean filtering works in pandas and give a simple example.
Think about how you pick only some rows based on a rule.
You got /4 concepts.
Describe how to combine multiple conditions in Boolean filtering and why parentheses are important.
Remember operator precedence and grouping.
You got /3 concepts.