last day (17 days later) » 

11:14 PM
1
A: How to check if a condition lasted for more than 15 mins?

Amit Vikram SinghI am posting code for 5 mins so that output matches your desired output. Change 300 to 900 for 15 mins. Steps: Convert the df['Date'] to datetime so that we can subtract two dates to know the time difference between them. Group the df by date and Call f for each group object. In f: max-continu...

 
Thanks! Can you explain the code if possible?
 
@Sumit Does it work on your dataset? If yes, I will add the explanation.
 
yes it does. But I want to understand the code in order to know if the output is as desired.
 
@Sumit I have added the explanation. Do you want me to explain the logic in computation of max_continuous_range?
 
Yeah that would be great! Also, what is g here?
 
11:14 PM
g is group object. Or simply the slice of data for a particular date. After .groupby on date, we have one g object for each date and we can access them by iterating groups.
In data, the time is always incremented by 1 min?
 

  last day (17 days later) »