BuildlyBuildly
DashboardExercisesProfileHelp
Back to all

Practice: Filtering

Drills tagged with this skill, unpassed first. Pass them all to mark the skill ready for scenarios.

Module 2: Data Analytics

0/3 done
Exercises (0/3)
  • 1
    Filter by Set Membership
    Context. Pull all orders from a specific set of regions. Your task. Write orders_in_regions(df, regions) that returns rows where df["region"] is in regions (a list of region codes). Example. regions ["A", "C"] → rows tagged A or C, in original order. Notes. Preserve original df order. Empty regions list → empty DataFrame.
    7 min· 10 XP
  • 2
    Filter by Numeric Range
    Context. Find rows in a numeric range — e.g., transactions between two amounts. Your task. Write amounts_between(df, low, high) that returns rows where df["amount"] is between low and high, inclusive on both ends. Example. amounts [10, 25, 50, 75, 100], low=25, high=75 → rows with 25, 50, 75. Notes. Both endpoints inclusive. low == high → only rows matching that exact value. Empty result if no values qualify.
    7 min· 10 XP
  • 3
    Filter by Substring (Case-Insensitive)
    Context. Filter a list of emails to those from a particular domain. Your task. Write emails_from_domain(df, domain) that returns rows where df["email"] contains domain as a substring (case-insensitive). Example. domain "gmail" matches "alice@gmail.com" and "carol@GMAIL.com" both. Notes. Case-insensitive match. No matches → empty DataFrame.
    7 min· 10 XP