Skip to content
RED SAG Skills
medium10 pts · first answer countspythonpandasgroupby

Numbering each customer's orders

Rows are sorted by date with customer values A, B, A, A. What is the new column n?

df['n'] = df.groupby('customer').cumcount() + 1
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions