df1 looks like this- (it has 3 min time interval window against each ID and Name)
ID Name Time Quantity Flag
A A 00:00:00 6 N
00:03:00 0 N
00:06:00 9 N
A B 01:09:00 3 N
C A 02:00:00 5 N
02:03:00 0 N
df2 looks like this-
ID Name Time
A A 00:00:03
A A 00:04:06
A B 00:05:02
C A 02:01:05
I want to change flag values of df1 to 'Y' if any values[ID,Name and time] from df2 is present in df1 time intervals ONLY IF the quantity is 0 for that row.
Desired Output-
df1-
ID Name Time Quantity Flag
A A 00:00:00 6 N
00:03:00 0 Y
00:06:00 9 N
A B 01:09:00 3 N
C A 02:00:00 5 N
02:03:00 0 Y