1

I am working on timeseries data and using pandas for analyzing the data. My data looks like:

enter image description here

The columns are "Datetime, date, time, price, a, b, c, area, y". Now I have to group this data by area which I can do by:

df.groupby('area')

Now I can sort this data on date column by:

df = df.sort_values(['date'])

But if I sort date column then the time column is automatically sorted, but I need for eg:

date        time     area
2018-09-13 02:00:00  5 
2018-09-13 03:00:00  5
2018-09-13 02:00:00  3
2018-09-13 03:00:00  3

How can I achieve this in pandas? Any suggestions! Thanks

ssh26
  • 287
  • 4
  • 12

0 Answers0