0

I would like to create new column containing part_of_the_day when the category of application is more used (max duration between the same category) for example the calendar is used 2 times: the afternoon and the night by comparing the duration, I try to take the afternoon one. how can i do this .

UserId  Date        category       part_of_day  Frequency   duration_max
1      2020-09-10   System tool     evening       1          3.436
1      2020-09-11   Calendar        afternoon     5          5.313
1      2020-09-11   Calendar        night         3          2.760
1      2020-09-11   Clock           night         2          0.418
1      2020-09-11   Communication  afternoon      35         59.936

I want this result :

   UserId   Date        category       part_of_day  Frequency   duration_max
1      2020-09-10   System tool      evening            1            3.436
1      2020-09-11   Calendar         afternoon          5            5.313
1      2020-09-11   Clock            night              2            0.418
1      2020-09-11   Communication    afternoon         35            59.936

`

I found similar problems on the forum but I couldn't modify the code to work with my data.

0 Answers0