P04PandasBeginnerImplement8 min

Filter High-Value Customers

Select active customers above a revenue threshold without accidentally including incomplete records.

#boolean masks#segmentation#pandas

Scenario

Marketing is preparing a retention outreach list for active customers whose lifetime value exceeds 10,000.

Problem statement

Filter a DataFrame to customers with lifetime_value above 10,000 and status equal to active. Exclude rows with a missing lifetime value.

Your Task

  1. Build each condition clearly.
  2. Combine conditions using Pandas boolean syntax.
  3. Return only the columns needed for the outreach list.

Example data

customers = pd.DataFrame({
    'name': ['Asha', 'Mira', 'Dev', 'Lina'],
    'lifetime_value': [12500, None, 8700, 15100],
    'status': ['active', 'active', 'active', 'inactive'],
})

Related Concepts

Boolean indexingCustomer segmentationData quality

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.