FunctionRacerProblemsRace

Distinct Buyers per Day

EasypandasPython

sales has columns day (text) and buyer (text). The same buyer can buy several times on a day. Return a dictionary mapping each day to the number of different buyers on that day.

Example 1

sales {"day":["mon","mon","tue"],"buyer":["ann","ann","ann"]}
returns {"mon":1,"tue":1}

Ann is one buyer on mon, one on tue.

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