Finding where most time of activity was spent

30 views
Skip to first unread message

Miki Tebeka

unread,
Sep 22, 2017, 9:58:01 AM9/22/17
to PyData
Hi,

Stackoverflow didn't yield an answer, I'd thought I'll try here :)

I have a data set with actions that have a start and end time. I'd like to label each row part of day (morning, noon, evening, night). Since some actions might start at one part and end in the other, I'd like to consider where most of the time was spent.

Say that morning is 6am-11am and noon is 11am-2am and I have an action between 10:30am to 1pm it should be labeled as noon.

One approach I though was to create a column for each part of day and calculate the number of seconds spent in each part (per row) then use idxmax to find the part of day. But then how do I calculate the time overlap between (start, stop) to the part of day?

Thanks,
--
Miki

Pietro Battiston

unread,
Sep 22, 2017, 3:39:05 PM9/22/17
to pyd...@googlegroups.com
Il giorno ven, 22/09/2017 alle 06.58 -0700, Miki Tebeka ha scritto:
> Hi,
>
> Stackoverflow didn't yield an answer, I'd thought I'll try here :)

Answered there ;-)

Pietro

Miki Tebeka

unread,
Sep 28, 2017, 1:28:13 AM9/28/17
to PyData
Thanks!

Reply all
Reply to author
Forward
0 new messages