import pandas as pd
from datetime import datetime
# calculate the year and month from '2021-01-01' to now
df = pd.DataFrame(pd.date_range('2021-01-01', datetime.now(), freq='M'), columns=['begin_month'])
# offset the month by 1
df['end_month'] = df['begin_month'] + pd.DateOffset(months=1)
# revise the format of the month
df['begin_month'] = df['begin_month'].apply(lambda x: x.strftime('%Y-%m-01'))
df['end_month'] = df['end_month'].apply(lambda x: x.strftime('%Y-%m-01'))
print(df)
result