I am trying to convert a column called Month_Next
from a dataframe called df_actual
from the last day of one month to the first day of the next. The column looks like this:
And I'm using
df_actual.Month_Next = pd.to_datetime(df_actual.Month_Next) + relativedelta(months=1, day=1)
and getting this error.
TypeError: unsupported operand type(s) for +: 'DatetimeArray' and 'relativedelta'
Which makes no sense to me since this exact code works in a different notebook where Month_Next
comes in as I believe a Timestamp object like so
Any ideas as to what's going on here?
This works just fine:
Month_Next = df_actual.AsOfDate + pd.DateOffset(months =1) - pd.offsets.MonthBegin(1)