def _response_delay(grouped): ts = (total_seconds(b.datetime - a.datetime) for conv in _conversations(grouped) for a, b in pairwise(conv) if b.direction == 'out' and a.direction == 'in') return ts
def interevents_time(records): """ The interevent time between two records of the user. """ inter_events = pairwise(r.datetime for r in records) inter = [total_seconds(new - old) for old, new in inter_events] return summary_stats(inter, 0.99)