Assuming the following dataframe:
date | id
2020-12-11 | A
2020-12-15 | A
2020-04-09 | B
2020-04-09 | C
2020-04-08 | C
2021-03-11 | D
2021-03-12 | D
2021-01-24 | E
2021-01-19 | E
Desired output:
date | id
2020-12-11 | A
2020-12-12 | 0
2020-04-09 | B
2020-04-09 | C
2020-04-08 | C
2021-03-11 | D
2021-03-12 | D
2021-01-19 | E
2021-01-20 | 0
Basically, if id is duplicate, we want to check if the dates are consecutive business days. If consecutive business days, keep both; else, only keep the smaller date, remove the latter date and replace it with the next business day, with id '0'.