pandas calculate same day 3 months ago dateoffset 1

pandas calculate same day 3 months ago dateoffset

>>> from pandas.tseries.offsets import DateOffset
>>> ts = pd.Timestamp('2017-01-01 09:10:11')
>>> ts + DateOffset(months=3)
Timestamp('2017-04-01 09:10:11')

Here is what the above code is Doing:
1. Import the pandas library as pd.
2. Import the DateOffset class from pandas.tseries.offsets.
3. Create a Timestamp object for January 1st, 2017 at 9:10:11am.
4. Add three months to the Timestamp object.

Similar Posts