I'd like to add multiple years to my date index in pandas, but have not been able to do so:
ts is a dataframe with a series and relevant dates. I would like to extend those dates by an additional several years in order to add other series for plotting/analysis.
ts.head()
date
2014-12-31 NaN
2015-12-31 0.617876
2016-12-31 0.472640
2017-12-31 0.426240
2018-12-31 0.297176
Name: BL-US, dtype: float64
I've tried
ts.index.union([ts.index[-1] + datetime.timedelta(years=x) for x in range(7)])
and received the following error:
TypeError: 'years' is an invalid keyword argument for new()
Any suggestions? Thank you!