If I understand you, you don’t actually want shift
, you simply want to make a new column next to the existing DATE
which is 180 days after. In that case, you can use timedelta
:
>>> from datetime import timedelta
>>> df.head()
ID DATE
8 0103bd73af66e5a44f7867c0bb2203cc 2001-02-01 00:00:00
0 002691c9cec109e64558848f1358ac16 2003-08-13 00:00:00
1 002691c9cec109e64558848f1358ac16 2003-08-13 00:00:00
5 00d34668025906d55ae2e529615f530a 2006-03-09 00:00:00
4 00d34668025906d55ae2e529615f530a 2006-03-09 00:00:00
>>> df["X_DATE"] = df["DATE"] + timedelta(days=180)
>>> df.head()
ID DATE X_DATE
8 0103bd73af66e5a44f7867c0bb2203cc 2001-02-01 00:00:00 2001-07-31 00:00:00
0 002691c9cec109e64558848f1358ac16 2003-08-13 00:00:00 2004-02-09 00:00:00
1 002691c9cec109e64558848f1358ac16 2003-08-13 00:00:00 2004-02-09 00:00:00
5 00d34668025906d55ae2e529615f530a 2006-03-09 00:00:00 2006-09-05 00:00:00
4 00d34668025906d55ae2e529615f530a 2006-03-09 00:00:00 2006-09-05 00:00:00
Does that help any?