I have a DataFrame with columns:-
Time channel-id user-id call-id call-duration
2020-06-25 00:06:22 abc dg33 3532 30
2020-06-25 00:06:34 dfd sd24 2342 35
2020-06-25 00:07:23 abs gf22 5467 40
2020-06-25 00:07:44 abc sd33 9233 42
2020-06-25 00:07:23 dfd sd24 4938 2
2020-06-25 00:08:44 abs hg34 2933 55
2020-06-25 00:08:43 abc lk33 2933 43
2020-06-25 00:08:00 dfd sd11 4532 56
2020-06-25 00:09:11 abc lf33 2283 76
2020-06-25 00:09:12 abc df43 4466 23
2020-06-25 00:09:55 abc cv45 8888 12
I want to calculate the life-span of the channel like channel abc started at 2020-06-25 00:06:22 but in the channel abc the last user joined at 2020-06-25 00:09:55.
I want to list all the channels with the channel life duration of each channel.
channel-id channel-life-duration
abc 5 minutes
xyz 300 minutes
I have mentioned 5 minutes and 300 minutes just to give an idea of the format.
Also, if possible I also want to count total and unique user-id and call-id.
channel-id channel-life-duration Total-user-id Tot-unique-user-id Total-call-id tot-unique-call-id
abc 5 minutes 10 6 11 10
xyz 300 minutes 11 7 12 9
I want to scale this to millions of rows so, how I can make the computation fast.