I'm trying to implement a condition where if the count of incorrect values is greater than 2 (2019-05-17 & 2019-05-20 in the example below) then the complete date (all the time blocks) is removed
Input
t_value C/IC
2019-05-17 00:00:00 0 incorrect
2019-05-17 01:00:00 0 incorrect
2019-05-17 02:00:00 0 incorrect
2019-05-17 03:00:00 4 correct
2019-05-17 04:00:00 5 correct
2019-05-18 01:00:00 0 incorrect
2019-05-18 02:00:00 6 correct
2019-05-18 03:00:00 7 correct
2019-05-19 04:00:00 0 incorrect
2019-05-19 09:00:00 0 incorrect
2019-05-19 11:00:00 8 correct
2019-05-20 07:00:00 2 correct
2019-05-20 08:00:00 0 incorrect
2019-05-20 09:00:00 0 incorrect
2019-05-20 07:00:00 0 incorrect
Desired Output
t_value C/IC
2019-05-18 01:00:00 0 incorrect
2019-05-18 02:00:00 6 correct
2019-05-18 03:00:00 7 correct
2019-05-19 04:00:00 0 incorrect
2019-05-19 09:00:00 0 incorrect
2019-05-19 11:00:00 8 correct
I'm not sure which time based operation to perform to get the desired result. Thanks
2019-05-17 04:00:00and2019-05-19 11:00:00. Pandas.Timestamp() allows you to compare the dates with simple >, <, == operations.