One solution that does not require pandas:
from datetime import datetime, timedelta
delta = timedelta(days=32)
start = datetime(2021, 1, 8)
end = datetime(2021, 5, 7)
dates = [start]
cur_date = start
# Remove two months from the end date
# 1. for the end date which we use as is
# 2. for the while loop which alwasy generates +1
while cur_date < end - 2 * delta:
# Add 32 days since delta does not support month
# and set the day to 1 for each generated date
cur_date = (cur_date + delta).replace(day=1)
dates.append(cur_date)
# Add the end date to the result
dates.append(end)
print(dates)
Output:
$ python3 ~/tmp/test.py
[
datetime.datetime(2021, 1, 8, 0, 0),
datetime.datetime(2021, 2, 1, 0, 0),
datetime.datetime(2021, 3, 1, 0, 0),
datetime.datetime(2021, 4, 1, 0, 0),
datetime.datetime(2021, 5, 7, 0, 0)
]
Making it into a pd frame should be easy from here (if that is the format you need)