0

I have a data with timestamp (date and time are in two separated columns)

id, device,action, day, time 658, FD, 1, 02-Mar-2008, 19:37:41 659, FD, 0, 02-Mar-2008, 19:37:46 660, HTD, 1, 02-Mar-2008, 20:32:17 661, HTD, 0, 02-Mar-2008, 20:32:18 662, HTD, 1, 02-Mar-2008, 20:32:22

How can I sort may data by timestamp like it is in one column ?

df['timestamp'] = pd.to_datetime(df['timestamp']) df = df.sort_values('timestamp')

Note: I am dealing with timestamp not textual columns as in this question How to sort a dataFrame in python pandas by two or more columns?.

I tried the code in that answer and it does not solve my problem.

0 Answers0