-1

I encountered this during an interview and can't think of a solution. This is the problem, suppose you had a dataset as follows (it goes beyond time 2 but this is just a sample to work with):
gsa_data = pd.DataFrame({
'time': [1, 1, 1, 2, 2, 2],
'names': ["Andy", "Bob", "Karen", "Andy", "...