In this exercise, you will filter data based on specific conditions to analyze customer groups. This will help you identify patterns and target customer segments.
Filter Customers Above Age 30:
Use a conditional statement to select rows where the Age column value is greater than 30.
Display the first few rows of the filtered data using head().
Filter High Spenders (Spending over $90):
Use a similar approach to filter rows where the Purchase Amount (USD) is greater than 90.
Print the first few rows of the result.
Python Code:
# 1. Filter customers above age 30
import pandas as pd
filtered_customers = df[df['Age'] > 30]
filtered_customers.head()
# 2. Filter customers who spent more than $90
import pandas as pd
high_spenders = df[df['Purchase Amount (USD)'] > 90]
high_spenders.head()