-2

I my trying to create a order to the following dataset, on email sent to each individual

Current data and make it look like (send_num added) the following

Expected data

Can anyone please help me how to achieve this, many thanks

  • 2
    Welcome to StackOverflow. Please take the time to read this post on [how to provide a great pandas example](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) as well as how to provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) and revise your question accordingly. These tips on [how to ask a good question](http://stackoverflow.com/help/how-to-ask) may also be useful. – jezrael Jun 14 '18 at 09:27
  • 3
    [Please don't post images of code (or links to them)](http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-on-so-when-asking-a-question) – jezrael Jun 14 '18 at 09:28
  • But it seems need [How to sort a dataFrame in python pandas by two or more columns?](https://stackoverflow.com/q/17141558) – jezrael Jun 14 '18 at 09:28

1 Answers1

0

Try this:

d["sent_num"] = d.groupby("email").cumcount() + 1
koPytok
  • 3,453
  • 1
  • 14
  • 29