0

I have the following question: How can I group by a dataframe based on 2 columns. One of them is an ID (integer) and the other one is a date in the format of (datetime64[ns]). So this is an example dataset of the input I have and the output desired:

Input

ID Date
1  2019-11-20 01:04:18
1  2019-11-19 01:04:18
1  2019-11-18 01:04:18

2  2019-11-20 01:04:18
2  2019-11-19 01:04:18
2  2019-11-18 01:04:18

3  2019-11-20 01:04:18
3  2019-11-19 01:04:18
3  2019-11-18 01:04:18

Expected output 
 ID Date
    1  2019-11-18 01:04:18
    1  2019-11-19 01:04:18
    1  2019-11-20 01:04:18

    2  2019-11-18 01:04:18
    2  2019-11-19 01:04:18
    2  2019-11-20 01:04:18

    3  2019-11-18 01:04:18
    3  2019-11-19 01:04:18
    3  2019-11-20 01:04:18
Vasilis
  • 143
  • 10

0 Answers0