Skip to content
Advertisement

Identify pairs of events then calculate the time elapsed between events

I have a dataframe with messages sent and received. I want to calculate the time it took for someone to reply to the message.

JavaScript

The method I thought of using was identifying pairs, so if sent =A and received =B, then there should be another entry with sent=B and received =A.

JavaScript

Then once I identify the pairs, I can calculate the time it took to respond with

JavaScript

I feel like I can do these separately, but I can’t seem to put them together.


EDIT

So as for the output, I guess I would need a separate dataframe that would list the senders and the time it took for someone to reply to the e-mail.

so with the example,

the message was sent by 78 and it took 60 min to respond. then a message was sent by 68 and it took 60 min to respond

Sender time_to_respond
78 60
68 60

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement