Most Orders Customer
customers has columns id and name (names are unique). orders has a column customer_id. Return the name of the customer with the most orders. If several tie, return the alphabetically first name. At least one order exists.
Example 1
customers {"id":[1,2],"name":["Ann","Bo"]}
orders {"customer_id":[2,2,1]}
returns "Bo"
Bo has 2 orders, Ann 1.
Constraints
- Every
customer_idinordersis anidincustomers
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Most Recent OrderMedium
- Person CitiesMedium
- Rearrange Products TableMedium
- Record ReadingsMedium
- Reformat Department TableMedium
- Revenue per ProductMedium
- Rising TemperatureMedium
- Salespeople Without Red OrdersMedium