Filter Groups in a DataFrame Using filter()
📖 Scenario: You work in a small bookstore. You have sales data for different book genres. You want to find which genres have total sales above a certain number.
🎯 Goal: Build a program that uses pandas to group sales by genre and then filter groups where total sales are more than 100.
📋 What You'll Learn
Create a pandas DataFrame with given sales data
Set a sales threshold variable
Use
groupby and filter() to keep only genres with total sales above thresholdPrint the filtered DataFrame
💡 Why This Matters
🌍 Real World
Filtering grouped data is common in sales analysis, marketing, and finance to focus on important categories.
💼 Career
Data analysts and scientists often use group-level filtering to prepare data for reports and decision-making.
Progress0 / 4 steps