I have a column of dates and I am trying to truncate them to be the first of the month for all the dates, for whatever month they are.
example:
dr = pd.date_range('20130101 09:12:56.1234', periods=3)
bs = pd.DataFrame(dr)
bs.columns = ['what']
bs
I can round to the Day as seen here:
bs.what.dt.round('D')
But if I Try to do Month, it fails:
bs.what.dt.round('MS')
ValueError: <MonthBegin> is a non-fixed frequency
Is there another way to do this?
I have been trying other means by trying to create a new column with a map and pulling out year, month etc.. but nothing I have tried yet has worked.