Get the last two events of a id and arrange it

Viewed 52

This is just a sample dataframe.

enter image description here

I want to obtain the last two Events of each id_num and make another data frame consisting of the id_num and last two Events as Event1 and Event2 respectively.

enter image description here

How can it be done?

3 Answers
Related