Here are my 2 data frames: df1
eid start_dt end_dt flag
1 2020-12-01 2020-12-07 0
1 2020-12-08 2020-12-15 0
1 2020-12-16 2020-12-23 1
2 2020-12-01 2020-12-07 0
df2
eid event_dt col1 col2
1 2020-12-01 . .
1 2020-12-09 . .
1 2020-12-17 . .
2 2020-12-02 . .
output df.
- If in df1 and df2, the eids match AND event_dt is between start_dt,end_dt
-- add a new column
-- update the flag
The output data frame df would look like this
eid event_dt col1 col2 flag
1 2020-12-01 . . 0
1 2020-12-09 . . 0
1 2020-12-17 . . 1
2 2020-12-02 . . 0
How would I go about doing this?