FunctionRacerProblemsRace

Order Number per Customer

EasypandasPython

orders has a column customer (text), and rows are in the order the orders were placed. Give every row its position among that customer's orders: 1 for their first order, 2 for their second, and so on. Return the list of positions in row order.

Example 1

orders {"customer":["ann","bo","ann","ann"]}
returns [1,1,2,3]

ann: 1, 2, 3. bo: 1. In row order: 1, 1, 2, 3.

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