I have to check if a date column is in a range. In particular I have to check if it is included in a range given by another date +/- n days. Suppose my dataframe is:
import pandas as pd
d = {
'date1': ['2019-09-11', '2019-09-12', '2019-08-02'],
'date2': ['2019-10-11', '2019-09-24', '2019-11-11']
}
df = pd.DataFrame(d)
I have to chek if (date2 - 5 days) < date1 < (date2 + 5 days)