I have the following table:
dt type item
0 2021-02-08 20:43:15 Requesting 1111
1 2021-02-08 20:43:25 Response 1111
2 2021-02-08 20:43:15 Requesting 2222
3 2021-02-08 20:43:27 Response 2222
4 2021-02-08 20:43:16 Requesting 3333
5 2021-02-08 20:43:19 Response 3333
6 2021-02-08 20:43:16 Requesting 4444
7 2021-02-08 20:43:21 Response 4444
8 2021-02-08 20:43:16 Requesting 5555
9 2021-02-08 20:43:23 Failed 5555
8 2021-02-08 20:43:17 Requesting 5555
9 2021-02-08 20:43:29 Response 5555
It is already sorted by item and then second sort by time.
I want to do a group-by and get a new table that will have the amount of time it took between a request to the response, and another column for how many rows it included (so for item 5555 it took 4 rows)
What's a good pythonic way to do it?