Need to add new rows to dataframe based on condition.
Current dataframe:
In this dataframe there are 4 columns. what i want to do ischeck the 'Time' column and check the nearest value for 12PM mid night in every night shift and add two new row as 11:59:59 and 00:00:01 with same values as the that nearest datapoint.
For examle: Closest value(to 12PM) for 03-01 Night is 21:46:54. so need to add two rows,
W25 03-01 Night RUNNING 23:59:59
W25 03-01 Night RUNNING 00:00:01
so final expected dataframe should be like this:
Sample data:
data={'Machine': {0: 'W5', 343: 'W5', 344: 'W5', 586: 'W5', 587: 'W5'}, 'State': {0: 'start', 343: 'STOPPED', 344: 'RUNNING', 586: 'STOPPED', 587: 'MAINT'}, 'Day-Shift': {0: '03-01 Night', 343: '03-01 Night', 344: '03-01 Night', 586: '03-01 Night', 587: '03-01 Night'}, 'Time': {0: Timestamp('2021-03-01 21:00:00'), 343: Timestamp('2021-03-01 22:16:54'), 344: Timestamp('2021-03-01 23:16:54'), 586: Timestamp('2021-03-01 23:48:45'), 587: Timestamp('2021-03-02 02:28:54')}}
Really appreciate your support !!!!!

