Jun-27-2022, 09:48 AM
Hi all
Thanks in advance for your help.
I have this below dataset.
The result below would be
Again, thanks a lot
B.
Thanks in advance for your help.
I have this below dataset.
Output:Visitor ID Visit time
AAA 27/06/2022 10:00:00
AAA 27/06/2022 10:05:21
AAA 27/06/2022 10:32:01
AAA 27/06/2022 13:04:01
AAA 28/06/2022 13:05:01
BBB 27/06/2022 11:00:00
BBB 27/06/2022 11:24:00
BBB 29/06/2022 11:24:00
I need for each visitor ID, assign a same visit number if the visit times ares in a 30min windows.The result below would be
Output:Visitor ID Visit time Visit number
AAA 27/06/2022 10:00:00 1
AAA 27/06/2022 10:05:21 1 (same id than before as this time visitis less than 30min than the visit before)
AAA 27/06/2022 10:32:01 1 (same id than before as this time visitis less than 30min than the visit before)
AAA 27/06/2022 13:04:01 2 (as the difference btw this time visit and preivous visit is more than 30min)
AAA 28/06/2022 13:05:01 2 (same id than before as this time visitis less than 30min than the visit before)
BBB 27/06/2022 11:00:00 1
BBB 27/06/2022 11:34:00 2 (as the difference btw this time visit and preivous visit is more than 30min)
BBB 29/06/2022 11:36:00 2 (same id than before as this time visitis less than 30min than the visit before)
Could you please tell me how I can do this in Python ? Or what logic I could use ?Again, thanks a lot
B.