ranges = df2.assign( Range=list(map(lambda row: list(range(row[0], row[1], 5)), df2[["From", "To"]].to_numpy())) ).explode("Range") matches = ( df1.merge( ranges, left_on=["ID", "From"], right_on=["ID", "Range"], how="left") ) RM_missing = matches.groupby(["ID", (matches["RM_x"] != matches["RM_x"].shift()).cumsum()]) Q_missing = matches.groupby(["ID", (matches["Q_x"] != matches["Q_x"].shift()).cumsum()]) matches = pd.concat( [ matches,
18:24
« first day (1 day earlier) ← previous day next day → last day (21 days later) »
Transcript for
Feb9
Feb '2310
Feb13
Discussion between Celeste Wilson and…
Imported from a comment discussion on stackoverflow.com/questi...