We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Filter Methods

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()]

Assignment

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.