1

I want to merger all depart_time value with the same location into a list

location    depart_time
022HK   1160
022HK   680
022HK   783.51667
022HK   1268.51667

desired ouput:

location  depart_time
022HK    [680, 783.51667, 1160 1268.51667]
Jack
  • 1,339
  • 1
  • 12
  • 31

1 Answers1

3

You can do df.groupby('location')['depart_time'].apply(list)

Sreeram TP
  • 11,346
  • 7
  • 54
  • 108