Excel COUNTIFS: count per customer
A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.
The task
Excel would need one `COUNTIFS` per customer. Return, for each customer, how many completed orders of at least 50 they have, as a DataFrame with the columns `customer` and `big_orders`. Leave out customers who have none.
What this exercise teaches
Filtering before grouping is the pandas form of COUNTIFS: the conditions decide which rows exist, and size() counts what remains per customer. Customers with no matching rows simply have no group, so they drop out.
A hint if you get stuck
Filter first, then count the rows that are left in each group. reset_index(name=...) turns the counts into a named column.
Try it now, free, no account needed
Your first 8 exercises on Pandasdrill are free. Open it on the practice page, solve it, and get instant feedback with a hint. A free account adds the worked solution; Pro unlocks every exercise, timed mode and the certificate.
Open this exercise