I need to calculate the operating time between failures of a equipment, respecting its operating schedule.
Basically I have a corrective maintenance dataframe with the start and end time in the format of the attached image:
I need a python code that calculates the time in hours between the end and start of each maintenance excluding times outside the operation calendar (that is, I need the time that it worked and did not fail).
The operation calendar is:
- Monday: from 07:15 am to 05:00 pm and after 10:20 pm to 11:59 pm
- Tuesday, Wednesday, Thursday and Friday: from 12:00 am to 5:00 pm and from 10:20 pm to 11:59 pm
- Saturday: from 12:00 am to 7:15 am
Can someone help me?