

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Multiple Conditions
incomplete
2: The Not Operator
incomplete
3: Filter Methods
incomplete
4: Binning
incomplete
5: String Operations
incomplete
6: Filtering With String Methods
incomplete
7: Sorting Data
incomplete
8: More Sorting
incomplete
9: Conditional Updates
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Pandas provides convenient built-in methods for common filtering operations. Each one returns a boolean Series you can use to index a DataFrame.
The .isin() method checks whether each value in a column appears in a given list:
target_platforms = df[df["platform"].isin(["PS5", "Switch"])]
The .between() method checks whether values fall within a range (inclusive by default):
mid_priced = df[df["price"].between(20, 40)]
The .notnull() method returns True wherever a value is present (not missing):
rated_games = df[df["metascore"].notnull()]
SnackStack is about to push a firmware update over the air. To avoid bricking devices, ops only wants to target devices that are in a rollout region, have reported a temperature recently, and have a battery level in a safe range.
Complete the get_update_targets function. It accepts a DataFrame, a list of rollout regions, and a min_battery/max_battery range, and returns only the devices safe to update.