Scenario
I have a dataframe with a given structure,and to sum it up at the end I want to find the time difference between the responses and requests of a service. It has the following columns:
- Timestamp
- Service
- Command
- Message_type
- Message_ID
And an example of data would be:
Timestamp Service Command Message_Type Message_ID
12:00:00 FoodOrders SeeStock() Request 125
12:00:02 FoodOrders SeeStock() Response 125
The output would have to be something like
Service Command Message_ID TimeDiff
FoodOrders SeeStock 125 00:00:02
What have I thought of doing
Grouping by Service,Command,Message_ID and add an additional column with some function that calculates the difference of time.
My actual questions
- Is my initial plan good? I am looking to try to make the code as clean and fast as possible
Thanks.