FunctionRacerProblemsRace

Most Recent Order

MediumpandasPython

orders has columns customer, date (like "2024-03-15") and amount. A customer never has two orders on the same date. Return a DataFrame with the columns customer and amount, holding each customer's most recent order, ordered by customer alphabetically.

Example 1

orders {"customer":["bo","ann","bo"],"date":["2024-01-05","2024-02-01","2024-03-09"],"amount":[10,20,30]}
returns {"columns":["customer","amount"],"rows":[["ann",20],["bo",30]]}

Ann's only order, then Bo's March order.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems